Find the path to your MAMP php bin directory. This is usually located within the MAMP folder in Applications:
/Applications/MAMP/bin/php/phpx.x.x/bin
Open Terminal and export the PHP bin path:
export PATH=/Applications/MAMP/bin/php/phpx.x.x/bin:$PATH