Sometimes it’s necessary/helpful to run MAMP’s version of PHP in the command line. A common issue I come across is systems that require the Mcrypt PHP extension (Yii2 and Laravel). It’s simple to setup a alias. Just copy and paste this code.

alias phpmamp='/Applications/MAMP/bin/php/php5.5.18/bin/php'

Note: Adjust your PHP version to match your desired version.

Then you can run PHP using phpmamp instead of php.