How to create alias to MAMP's PHP installation
In linux and MacOS X we can create an alias for our bash profile. Fire up the terminal, open a
.bash_profile from root using following command.
This will open nano with the contents, at the top in a blank line add the following line:
This will create an alias, phpmamp, so that you can take advantage of the MAMP installation of PHP. Please take note of the PHP version, in this case 5.4.10, as with different versions of MAMP this may be different. Check your installation and see what version you have, and replace the number accordingly.
With that setup, we are ready to install composer. This is a two step process if we would like this to be installed globally, while you would only need to do the first step if you would like this installed to the local working directory only.
First, run the following command in the terminal:
curl -sS https://getcomposer.org/installer | phpmamp
Note that instead of the standard ‘php’ at the end, we are using ‘phpmamp’ so that we correctly use the MAMP installation of PHP.
Next, we want to make this available globally, so we need to move the file to ‘/usr/local/bin/composer’. To do this, run the following command:
sudo mv composer.phar /usr/local/bin/composer
Terminal will ask you for yor password, after entering it and pressing the ‘return’ (or enter) key, you’ll have a working global installation of composer on your mac that uses MAMP!
You can verify your installation worked by typing the following command: