Set up MAMP php on macOS

Dec 15, 2020


  1. You have already installed MAMP on your Mac [See installation guide here:]
  2. You know Vim [see cheatsheet :]

First check your current php directory

which php

it would show


to change php executable from old directory to MAMP php, you should edit bash_profile

source ~/.bash_profile
vim ~/.bash_profile

and add this line

export PATH=/Applications/MAMP/bin/php/php<version_number>/bin:$PATH

The version is MAMP php’s available version , for example if the version is 7.1.6.

export PATH=/Applications/MAMP/bin/php/php7.1.6/bin:$PATH

After finishing, check the version and which php again

php -vwhich php

it should show exact version on MAMP.