I'll assume you have composer and Homebrew installed.
If you already have Drush running you better uninstall it.
You can do that by running this command if you had previously installed it using Homebrew:
$ brew remove --force drush
Find the versions of Drush you want to run here https://packagist.org/packages/drush/drush
I decided to have Drush 7 as default global Drush version. To do so I ran this command:
$composer global require drush/drush:7.x-dev
Run this command instead to install the latest stable version of Drush as default:
$composer global require drush/drush
Then edit your .bashrc ( if using MacOS) .bash_profile (for Linux) by using the following command:
and add the following line:
If you are using oh-my-zsh bash profile then edit the .zshrc file instead.
Restart your terminal.
Run $drush command to see if it works
I will choose Drush 8 as my alternative Drush version for this tutorial.
Create a directory for each Drush version you want to have running.
You can do it anywhere but it will be better to have it in the user directory.
Then cd to that directory and run the following command to install Drush8 inside:
$composer require drush/drush:dev-master
Then edit your .bachrc file or .zshrc again and add the following alias. You should add one alias for every Drush version you have installed:
Restart your Terminal.
After that you can call $drush command for the default drush version ( drush7 in my case) and $drush8 command to call Drush 8 Version.
Copyright © 2015 - 2017 - ParallelDevs