Quick tip: Use bash aliases to easily run multiple versions of drush at once
Quick tip: Use bash aliases to easily run multiple versions of drush at onceSunday, 12th May 2013
There are times where it can be desirable to run two or more different versions of drush on one computer, or even multiple versions for one user.
For example, if you're using a server running the 1.x (stable) branch of Aegir and you attempt to upgrade from drush 4 to 5 globally all of your provision tasks will start failing, rendering Aegir completely useless.
The "real" solution is to upgrade Aegir to the 2.x branch but if you're looking for a quick fix it's easier to just install drush 5 in parallel with drush 4 for your user.
Steps to install drush 5 in parallel with drush 4:
This assumes you already have drush 4 installed, so that running $ drush status
will report version 4.x
- Download the latest version of drush 5 from the project page.
- Extract the contents of the drush tarball into your home directory in a folder called drush5, so that the drush files can be found at
~/drush5
. - Edit or create either
~/.bashrc
or~/.bash_profile
and add the following line:alias drush5='~/drush5/drush'
. - Reload your terminal/console or run
$ source ~/.bashrc
or$ source ~/.bash_profile
as appropriate (whichever file you edited).
That's it! if you run $ drush5 status
you should see a drush report a version number 5.x
You can now swap between drush 4 and 5 easily whenever you need to.
These steps can be adapted to do the same thing in reverse and have drush 5 run with the drush
command and drush 4 with drush4
, or you could even have each version explicitly mapped to drush4
and drush5
- it's up to you :)
Syndicate: planet drupal