There are different ways to install PHPCS, the method below uses PEAR which installs it within your PHP installation.
First, locate the active MAMP Pro PHP installation.
$ which php
It will return something similar to /Applications/MAMP/bin/php/php7.2.1/bin/php
. Go to the bin
directory.
$ pear install PHP_CodeSniffer
That will install PHPCS. 💥
As I bonus, configure it to work with WPCS (which has been already downloaded)
$ phpcs --config-set installed_paths ~/.scripts/wpcs
When MAMP updates are installed, they generally include updated versions of PHP. So make a note that when you update MAMP (or if you toggle between PHP versions) you will need to reinstall PHPCS.