Drush, The Tool You Love But Hate To Manage

You need Drush.

I need Drush to work on Pantheon. Pantheon's documentation states that they only support Drush 5, and since it's not my data I'm managing but my clients', that's what I have to use.

In fact, it's annoying to work with Drush. That is, the magic stuff it does when you use it isn't annoying and is quite useful. But keeping all the versions you need for all the different use-cases is what's quite annoying.

This is part of the reason I made this D8 core issue: https://www.drupal.org/node/2242947

I also wrote a little about some of this before.

But all that aside, here's my solution:

How-To

This isn't really a Drush how-to. It's a bash how-to.

I've added three directories to my bash .profile path:

export PATH=/Users/paulmitchum/pear/bin:/Users/paulmitchum/.composer/vendor/bin:/Users/paulmitchum/bin:$PATH

The first one is PEAR's path. This way any binary I manage with PEAR is found before the others.

The second one is Composer's global binary directory.

The third is a bin/ directory I've created in my home directory.

I have Drush 5 installed via PEAR. It just so happens that Drush 5.10.0.0 is the last version available through PEAR.

I have the latest bleeding-edge Drush installed via Composer in the bin/ directory. You could also install it in Composer's global directory.

Given this setup, bash will always find Drush 5, unless it's not installed.

So therefore, when it's time to use something other than Drush 5, I type this: sudo pear uninstall drush/drush

When it's time to use Drush 5 again: sudo pear install drush/drush-5.10.0.0

After you manage which Drush is installed this way, you might need to either close the terminal and re-open it, or type source ~/.profile

I'm also in the habit of typing drush --version more than I really should (or should have to).

..And Finally...

One day I will be able to uninstall Drush 5 and never re-install it. But I have no idea when that day will be.