4

I have Drush 6 installed in my system.

I need to install Drush 5 too (hosting doesn't support Drush6), how do I install Drush5 without uninstalling Drush6 and use both of them simultaneously, Drush6 for local development and Drush5 for SFTP.

7
  • What OS are you on for your local environment? I don't know what features in Drush 6 you need, 5.9 is pretty stable and works for the practically everything I do. Dec 4, 2013 at 13:54
  • I use ubuntu. I work as freelancer so in one project I was recommended to use Drush6 for their make files (Im not expert in those things). Since then I have Drush6, but for another project in Pantheon servers they don't support Drush 6, I need Drush 5
    – Sara
    Dec 4, 2013 at 14:07
  • I actually work with clients on Pantheon all the time and I'm currently on Drush 6.1.0 and haven't run into issues yet. Pantheon also has a set of their own drush tools called Terminus. Could you update your question with the errors you're actually getting? Dec 4, 2013 at 14:23
  • I am also using Terminus and aliases from Pantheon, but while using their alias drush sa gives me the sites available and when I do drush @sitename.env status it gives Unexpected results. I have been in contact with Pantheon support team, they (Ricky Pugh) say its because I am using Drush 6. I wonder how you are working, can you verify you get same status from drush SITE status for both local environment and Pantheon environment?
    – Sara
    Dec 4, 2013 at 14:31
  • It might be your alias. When I run drush site status normally, I get the "to suppress this error, add the option --strict=0", so I add it and run again, and get back the status of the site as normal. Dec 4, 2013 at 14:55

3 Answers 3

3

In your .bashrc:

alias drush5=/path/to/drush5/drush
alias drush6=/path/to/drush6/drush

With this, drush5 will give you Drush 5, drush6 will give you Drush 6, and drush will give you whichever of these appears first on your $PATH.

Rename your aliases to suit.

4
  • so you mean download the Drush folder and make a bash profile. Ok, I was hoping some solution like apt-get install. I'll give it a try
    – Sara
    Dec 4, 2013 at 16:04
  • voila, it works... thanks... Yes Pantheon is crap... Acquia uses Drush 4.7 still when I run Drush6 for SFTP, it has no issues.\
    – Sara
    Dec 4, 2013 at 16:20
  • I wouldn't be so harsh on Pantheon; based on what I saw in the related issue that Clive cross-posted, it sounds like their aliases are fine, and it's a Drush issue with db-url. Someone should post an issue in the Drush queue for resolution in Drush 6 and Drush master. Dec 4, 2013 at 18:36
  • I was getting -bash: drush10: command not found error. I closed and reopened my putty, then the issue is gone.
    – siddiq
    Dec 9, 2020 at 22:53
1

One option on Debian/Ubuntu is to use the "alternatives" system to register multiple different versions as alternatives, and switch between them. That way, the command drush can be switched to point to different versions, without having to change any scripting you've done elsewhere.

However, this isn't as useful as you'd think, as switching between them is still a bit cumbersome: update-alternatives requires you to provide the full path to the version of Drush you want to make temporarily "primary".

With that in mind, this blogpost (disclaimer: my own) explains how to script the alternatives system to switch between Drush versions using something like switchdrush VERSION and sudo access. If you're not on a Debian-based *nix, then that scripting should be adaptable, to instead just change any /usr/bin/drush symlink.

1

Thank you J-P!

The link to http://www.jpstacey.info/blog/2014-04-07/switching-between-drush-major-versions.html helped me a lot on Ubuntu.

However, you have to adapt the grep-command in case you are using a localized (non-English) OS/Terminal.

In my case (Ubuntu 14.04 LTS - German) i had to replace

command=`update-alternatives --display drush | grep "priority $version" | awk

With

command=`update-alternatives --display drush | grep "Priorität $version" | awk

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.