Installing Drush for developing Drupal-site is a must-have for each developer.
Drush is a command line scripting interface for Drupal. By using a lot of useful commands, you can interact with code like modules, themes, profiles.
You can run update.php, execute sql-queries, clear the cache and a lot more!
Since we can get started now with developing Drupal 8 sites it's necessary to have Drush 8 installed. Drush 8 is compatible with Drupal 6, 7 and 8.
Drush 8 needs PHP 5.4.5 or higher to be installed.
Before we can install Drush 8, we have to install Composer globally. Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
Run this commands in your Terminal window:
curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer
Now we need to add Composer's directory path to our bash_profile:
$ export PATH="$HOME/.composer/vendor/bin:$PATH"
Reload your terminal window or re-source the configuration you just added with this command:
$ source ~/.bash_profile
Installing Composer was that easy! Installing Drush will be even more easy!
We need to install Drush froml the latest HEAD with only one command:
$ composer global require drush/drush:dev-master
Now Drush is installed, we can check if everything is installed correctly by using this command:
$ drush status
This will output some configuration info and the Drush version.