If you develop using MAMP, you need to use MAMP version’s of php instead the OSX one.
1° Verify which PHP is used by your Terminal
Open terminal and add:
$ which php
If you are use default Mac OSX apache + php server, you see as terminal response
“ /usr/bin/php ”
2° Add MAMP to $PATH variable
We will modify the “$path” variable by modifying the file “~/.bash_profile” located in root user folder. Type:
sudo nano ~/.bash_profile
Now write in the file the new “$path” variable that terminal has to use:
export MAMP_PHP=/Applications/MAMP/bin/php/php7.4.9/bin
export PATH="$MAMP_PHP:$PATH"
Save and exit.
3° Load “.bash_file” and check
Type: source ~/.bash_profile
and check by typing again $ which php
This time the response must be
“ /Applications/MAMP/bin/php/php7.4.9/bin/php ”