Reputation: 106
Is it possible to have several versions of composer on same (mac) machine? For instance, I want to experiment with the latest version (v0.17.x) while being able to work with my older projects that run on the stable release (0.16.x)
Upvotes: 0
Views: 85
Reputation: 5868
Yes. For example create a directory called ~/16.x (ie off your home directory), change to that directory and use npm to install composer-cli, composer-playground and composer-rest-server. but don't use the '-g' option. This will install into the 0.16.x directory. Now create another directory for example ~/17.x and do the same but install the @next versions. Again make sure you don't use the '-g' option.
Now you can then point your path to either the 16.x version or the 17.x version in a command window depending on which one you want to target, for example if I want to use 16.x I would do
export PATH=~/16.x/node_modules/.bin:$PATH
then check by doing
composer -v
The thing you cannot do is easily swap the file system card store used. So I either clear out the card store before swapping versions or I rename the card stores eg.
mv ~/.composer ~/.composer_16
mv ~/.composer_17 ~/.composer
to swap a 17.x card store in place of a 16.x card store
Obviously if I don't have one to start with then it will be created when I use the various commands.
Upvotes: 1