How to change pre-installed PHP version to MAMP in Mac/OSX
If you are using Mac OSX for the first time and switched from the windows environment and want to develop some cool web-based application then you need to install MAMP which is absolutely free. After installing MAMP on your local environment you need to add the MAMP version of PHP to the PATH variable.
Instructions to Change PHP Installation:
First, Let’s find out what version of PHP we’re running (To find out if it’s the default version). To do that, within the terminal, run this command:
This should output the path to the default PHP install which comes pre-installed by Mac OSX, by default it has to be (Assuming you’ve not changed it before):
Now, We just need to swap this over to the PHP that is installed with MAMP, which is located at
To do this, We need to edit the .bash_profile and add the MAMP version of PHP to the PATH variable.
Within the Terminal, run
Type i and then paste the following at the top of the file:
Hit esc, Type :wq, and hit enter.
In Terminal, run
Now type in which php again and look for the updated string. If everything was successful, It should output the new path to MAMP PHP install.
Happy Coding 😉