First of all, you need to make sure that PHP is set to run from MAMP, not from Apple's pre-installed instance of PHP. If you go into terminal and run:
it is possible that you'll get something like
This is the Apple's pre-installed instance of PHP, not MAMP's, so any modules you install will not take effect within MAMAP, unless you set the MAMP's php binaries to your path variable.
Open the terminal and run the following two commands: