Set up MAMP php on macOS

M
Dec 15, 2020

--

Assemption

  1. You have already installed MAMP on your Mac [See installation guide here: https://www.mamp.info/en/downloads/]
  2. You know Vim [see cheatsheet : https://vim.rtorr.com]

First check your current php directory

which php

it would show

/usr/bin/php

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.

--

--