I was trying to generate model code from cake command line tool. But got this issue.
Warning Error: PDO::__construct(): [2002] No such file or directory (try
In my case it was because I was calling the wrong version of PHP. I.e. I was using /usr/bin/php which when MAMP Pro's php is /Applications/MAMP/bin/php/php5.3.29/bin/php
/usr/bin/php
/Applications/MAMP/bin/php/php5.3.29/bin/php