Should do the trick. It will - as Tom Haigh mentioned - add the MAMP PHP executable to the path so you can use "php" instead of the full path.
回答3:
Another way that works that may be a little cleaner with regard to PHP versions is to create an alias in your bash profile that points to the specific php binary that you want to run when you run things like composer or other cli tools. This has the benefit of avoiding some potential library and php.ini config compatibility issues with the installed version of php in OSX.
For instance, if you want to point to php 5.4.1 in MAMP, edit your .bash_profile file in your editor of choice (nano, vi, etc.):
# nano ~/.bash_profile
Add this below your PATH statement:
alias php=/Applications/MAMP/bin/php/php5.4.10/bin/php
Save and quit (CTRL+X in nano, :wq in vi). Quit Terminal. The next time you try to call php from the cli, you'll be using the 5.4.10 version installed with MAMP.
Remember to update this path if you update MAMP with a more recent version of PHP.
回答4:
Yes, I think it is here: /Applications/MAMP/bin/php5/bin/php
You can either add /Applications/MAMP/bin/php5/bin/ to the front of your path or create a symlink in /usr/bin (there probably is one there already for the default PHP installation)