This page descibes how to set up a Mac to be a local development host server
MAMP is a free, local server environment that can be installed under macOS (and Windows) with just a few clicks.
There is a pro version but it is not necessary to setup a working dev environment.
The installation is pretty straightforward using MAMP documentation
Using several PHP version
10.15.x and after
Osx now uses zsh instead of bash, .bash_profile won’t work anymore.
The new file name is ~/.zshrc
Make sure you have the following code in it:
PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1` export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH
Make sure in MAMP PRO you have a box checked off under the PHP tab “Activate command line shortcuts...”
10.14.x and before
Osx uses .bash_profile to set the CLI version of PHP.
The file is located at ~/.bash_profile
Make sure you have the following code in it so your PHP CLI version will use the version accordingly to your MAMP PHP version selected:
PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1` export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH
Make sure in MAMP PRO you have a box checked off under the PHP tab “Activate command line shortcuts...”