Generally, MAMP is not installed in a place that wp-cli
expect it to be installed. And the MySQL socket file is needed to by the application.
Creating a symbolic link would help.
-
Locate the socket file location either in
tmp
orvar
netstat -a | grep mysql
In the case of MAC Sierra and MAMP PRO, you have
/Applications/MAMP/tmp/mysql/mysql.sock
-
Create a symbolic link to this file
cd /var sudo mkdir mysql sudo chmod 755 mysql cd mysql sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock mysql.sock
If this did not work you can also add a symbolic to tmp
folder.
cd tmp
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock mysql.sock
This is a tweak to the answer by @Brain Lowe here