If you are using MAMP, you will need to create a symlink for /usr/bin/php and /usr/bin/mysql to MAMP's executable, something like this:
ls -lah /usr/bin | grep sql lrwxr-xr-x 1 root wheel 26B 26 Mar 2012 mysql -> /usr/local/mysql/bin/mysql ... sudo mv /usr/bin/mysql mysql-mac sudo ln -s /Applications/MAMP/Library/bin/mysql /usr/bin/mysql sudo mv /usr/bin/php php-mac sudo ln -s /Applications/MAMP/bin/php/php5.4.4/bin/php /usr/bin/php
Time machine backups sometimes ignore this folder (same with
/etc/hosts). Also, when you upgrade Mac OS X,
/usr/bin/php are reset, so you might want to copy them for future upgrades:
sudo cp /usr/bin/mysql /usr/bin/mysql-to-reset-in-case-of-os-updgrade sudo cp /usr/bin/php /usr/bin/php-to-reset-in-case-of-os-updgrade
If you don't correctly map the executables via symlinks, you might get some strange errors with
drush, for example, this can happen when trying to install Drupal in the command line:
drush si --db-url=mysql://root:root@localhost/database -y You are about to DROP all tables in your 'database' database. Do you want to continue? (y/n): y No tables to drop. [ok] Starting Drupal installation. This takes a few seconds ... [ok] WD php: Exception: In order for Drupal to work, and to continue with [error] the installation process, you must resolve all issues reported below. For more help with configuring your database server, see the installation handbook. If you are unsure what any of this means you should probably contact your hosting provider.Failed to connect to your database server. The server reports the following message: SQLSTATE[HY000]  No such file or directory.Is the database ...
Also, if you switch versions of PHP in the MAMP interface, make sure you are using the correct executable on the command line.