Hướng dẫn cài đặt Drush sử dụng Composer trên Mac OS X 10.9 Mavericks

Hướng dẫn cài đặt Drush sử dụng Composer trên Mac OS X 10.9 Mavericks

Following on from our previous guide “Creating and using an public/private SSH key-pair in Mac OS X 10.9 Mavericks” in which we walked you through the process of setting up Git on Max OS X 10.9 Mavericks, we’re now going to look at installing Drush using Composer.

If you’re never heard of Drush before, the description provided on the  Drush GitHub repository offers a succinct and accurate explanation of what Drush is and the tools it makes available to you:

Drush is a command line shell and Unix scripting interface for Drupal. If you are unfamiliar with shell scripting, reviewing the documentation for your shell (e.g. man bash) or reading an online tutorial (e.g. search for "bash tutorial") will help you get the most out of Drush.

Drush core ships with lots of useful commands for interacting with code like modules/themes/profiles. Similarly, it runs update.php, executes sql queries and DB migrations, and misc utilities like run cron or clear cache.

Ultimately our goal in these series of guides is to give anyone both experienced and inexperienced alike the knowledge and skills required to configure their system so that an installation of Drupal can be run from it with a suite of tools available for them to use from the get-go.

Let’s begin.

Installing Composer

Rather than installing Drush manually, we’re going to let a tool called Composer do all the hard work for us. Composer is a tool for handing dependency management the full description for which can be found on the Composer site. In a nutshell though, the following sums up Composer well:

Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs and it will install them in your project for you.

Let’s install Composer. Open a new instance of the Terminal by either navigating to the Applications folder within the finder followed by the Utilities sub-folder, or alternatively by pressing “Cmd+Space” and typing “Terminal” followed by the “Enter” key.

Once open, type the following command to ensure you’re in your home directory:

cd ~/

To download composer, type the following command into the Terminal and hit enter:

curl -sS https://getcomposer.org/installer| php

At this point you could type “~/composer.phar --help” into the command line and you’ll most likely get a list Composer help documentation, but we want to be able to access Composer simply by typing the command “composer”, so let’s move the *.phar file into our “/user/local/bin” directory.

Note: On a fresh installation of OS X 10.9, the “/usr” directory will very likely be empty. If this is the case, to enable us to successfully move Composer to “/usr/local/bin/composer” you’ll need to type the following two commands“sudo mkdir /usr/local” and “sudo mkdir /user/local/bin”. After typing the first command, you may be prompted for your system password. Simply enter it to continue.

Now we’re all set to move Composer. To do this, type the following command into the Terminal:

mv composer.phar /usr/local/bin/composer

Note: If you get an error trying to move the file, prefix the command above with “sudo” and try again.

We should now be able to type “composer” into the terminal and get something other than an error returned. Try this out by typing “composer”and hitting enter.

Adding the Composer “bin” directory to our path

Once Drush is installed, we will be able to type“~/.composer/vendor/bin/drush” followed by the Drush command of our choice, but who wants to do that every time? 

To be enable the ability to type “drush” followed by our command we need to add Composer’s bin directory to our path.

In your home directory “~/“ type the command “nano ~/.bash_profile”and add the following line to the file that opens up:

export PATH="$HOME/.composer/vendor/bin:$PATH"

Quit Nano, by pressing “Ctrl+X” and when asked if you wish to save the document type “Y” and hit “Enter”.

Finally we need to re-source our “.bash_profile” file by typing “source ~/.bash_profile” into the Terminal (alternatively you can quit and re-open the Terminal).

Installing Drush

At this point, installing Drush is a piece of cake. Simply type the following into the Terminal and hit “Enter”

composer global require drush/drush:dev-master

Drush should now be installed. To ensure it is, type “drush” into the command line and you should see a series of Drush help documentation.

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Tommy Tran

Tommy Tran owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy
  • Phone/Zalo: (+84) 944 225 212
  • WhatsApp: (+84) 944 225 212
  • Line Messenger: (+84) 944 225 212
  • Email: asaleotestf@gmail.com
  • Telegram Messenger: https:/t.me/tommytran0401

Quảng cáo việc làm

 

Thích hợp các bạn nữ mảng thợ may làm việc tại nước NGA

Đơn hàng Tuyển dụng 100 Thợ may đi Nga(đợt 1 tháng 3.2021, đợt 2 tháng 5.2021). Lương thực lãnh 800 USD, bao ăn ở, vé máy bay và visa, phí xuất cảnh(1800 USD)trả khi đi làm có lương. Bạn có thể liên hệ CÔNG TY qua Phone/Zalo: (+84) 944 225 212. Công ty sẽ tư vấn cho bạn.

Xem chi tiết: >>> https://bit.ly/3o9NOfR

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
10 lí do khiến Adobe thua cuộc trong cuộc chiến Flash di động với Apple

10 lí do khiến Adobe thua cuộc trong cuộc chiến Flash di động với Apple

Vừa qua, Adobe đã quyết định sẽ không còn hỗ trợ FLash Player cho các trình duyệt web di động nữa. Qua đó, ta có thể thấy rằng Adobe đã thua Apple trong cuộc chiến căng thẳng kéo dài về nền tảng phát triển ứng dụng Web này.

blogspot

Cộng đồng Blogger Việt điêu đứng vì Blogspot bị chặn tại Việt Nam

Những ngày gần đây, cộng đồng blogger Việt lại một phen điêu đứng trước việc các nhà mạng trong nước liên tục chặn dịch vụ này và gần như các trang sử dụng blogspot dạng subdomain.blogspot.com không thể truy cập và nếu có cũng phải dùng proxies hay công cụ của bên thứ 3 hoặc ít nhất phải dùng domain riêng. Đây có thể là một thực tế đã được dự báo trước?

Viết bài PR trên Mạng Xã Hội như thế nào là hiệu quả?

Viết bài PR trên Mạng Xã Hội như thế nào là hiệu quả?

Giống như một bài viết PR tốt, hay bài thuyết trình trong thang máy ngắn gọn trong 1 phút, sử dụng status FB hiệu quả tất cả đều phải gọn gàng và chặt chẽ khiến người đọc không có một cơ hội để từ chối.