Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run composer on MAMP 's php version?

I can't run composer install because my php's version on my OS is not enough updated (5.5.36). So i tried to install composer globally with my MAMP's php(5.6.10)

1) I create alias for my MAMP's php

nano ~/.bash_profile
alias phpmamp='/Applications/MAMP/bin/php/php5.6.10/bin/php'

2) Run this line to install composer

curl -sS https://getcomposer.org/installer | phpmamp

3) Run this line to move composer

sudo mv composer.phar /usr/local/bin/composer

Composer is installed (run composer on terminal works)

This is a the tutorial.

But when i want to run composer install, composer uses my OS php.

Any idea ?

like image 526
Adrien Castagliola Avatar asked Nov 29 '16 17:11

Adrien Castagliola


1 Answers

Those lines worked for me. I override the OS PHP path to my MAMP PHP path.

PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
$ export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH
$ source ~/.bash_profile

You can check the version by running :

$ which php

The complete solution

Thanks to @Andrew Patton

like image 63
Adrien Castagliola Avatar answered Oct 17 '22 21:10

Adrien Castagliola