When I first started learning Drupal, I remember the process of enabling and disabling modules on the Modules page took for-ev-er. My laptop was in serious danger of getting hurled across the room due to my frustration. Then I discovered drush, and I could download and enable modules with ease instead of pain and suffering. Of course there's a lot more you can do with drush than just download and enable modules; this is just one example.
I've been using Drush 6.x on my local machine for quite some time now. Poking around Drupal 8's UI and seeing what's new, I haven't missed drush too much...until it was time to test drive a new contributed module for Drupal 8. When I typed into my Terminal window
drush dl page_manager, I got quite the error message:
Drush 6.x only works with Drupal 6 or 7. If I wanted to use Drush on my Drupal 8 site, I would need to upgrade to Drush 7.x.
I followed the instructions in the error message (which I think means to say "Drush 6.1.0 does not support Drupal 8"), which tells me to see http://drupal.org/project/drush for more information. Once there, I find that the Drush project has been moved to GitHub.
So over to Drush's GitHub project page I go. There's a lot of documentation on this page, and this compatibility chart tells me which version of Drush I need for Drupal 8 (Drush 7.x) and which branch of the repo I'll need as well (master).
But before I dive into downloading the master branch, I scroll down to try and find upgrading instructions. Sure enough, there's an Install/Update section with instructions about how to upgrade Drush using Composer.
The first instruction is to "Install Composer globally (if needed)." I couldn't recall if I had or not (it seemed like maybe I had already), so I typed into my Terminal window:
which composer and it returned
/usr/local/bin/composer, which means, yes, I already had installed Composer globally. (If you need to install Composer, go here.)
Secondly, I wanted to make sure Composer's global bin directory is on the system PATH, so I copy/pasted the commands suggested in the Drush documentation:
sed -i '1i export PATH="$HOME/.composer/vendor/bin:$PATH"' $HOME/.bashrc source $HOME/.bashrc
This ensures that when I type in composer commands, my shell knows which program to run, without needing the full path to the executable.
Now I'm ready to install Drush 7.x using Composer. I entered the following into my Terminal:
composer global require drush/drush:dev-master
Composer does its thing and downloads the correct branch from the drush git repository:
And, presto! I enter
drush status into Terminal and I can see that I'm now running Drush 7.0-dev and Drupal 8.0.0-dev.
drush dl page_managerand
drush en page_managerinside my Drupal 8 site, I get results, not errors.