Install Drush on Linux or Mac OS

Ready for review -- AWAITING PEER REVIEW
Description: 
You will learn how to install Drush on your Linux or Mac OS machine.
Overview: 

Install Drush 8 (stable) to use with Drupal 6, 7 or 8

Steps: 

You can install Drush using composer, which is a tool you will probably need for other things, or downloading the Drush script and moving it into the /usr/local/bin directory.

Installing Composer
To install composer on your machine, run these commands in your terminal:

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

You should see something like this once above command is run.

#!/usr/bin/env php
All settings correct for using Composer
Downloading...
Composer successfully installed to: /home/username/composer.phar

To be able to use Composer globally we should move it to /usr/local/bin/composer.

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

Now we should be able to use Composer gloabally. To test type the command composer. We can also add composers global bin directory to the system path with the code below.

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

Install Drush 8 with composer:
In order to use Drush with the last 3 version of Drupal (including Drupal 8), you need to install Drush 8.

Drush compability with Drupal


$ composer global require drush/drush

To test and see your drush version do the command below.

drush --version

Installing Drush directly
To install Drush using the official repository, use the following commands

wget http://files.drush.org/drush.phar

Now, you need to give execution permissions and move the drush.phar file to the $PATH destination, usually /usr/bin/local

chmod +x drush.phar


sudo mv drush.phar /usr/local/bin/drush

Notice that when you move the file, you are likely to rename the file, so you can use a shorter command (in this case drush)

To finish, in order to enrich the bash startup file with completion and aliases, you'll need to run the following command

drush init

That's it, you can test your install by running
drush core-status

Comments

On ubunutu 14.04 I had to move composer.phar to /usr/local/bin using
sudo mv composer.phar /usr/local/bin/composer
And make sure /usr/local/bin is in your PATH.