Drupal Association Individual MemberZend Certified Engineer Details

Running Drush in Mac OS X 10.6 (Snow Leopard)

To run drush - the Drupal Shell - you need to have a php shell command installed. Up to Mac OS X 10.5 I just used the php command delivered by Apple. In Mac OS X 10.6 (Snow Leopard) it changed to be version 5.3 which currently still conflicts with Drupal 6 and therefore breaks drush.

Update: From version 6.14 on Drupal core works with PHP 5.3.

There are several ways of running PHP in the Mac world: the PHP delivered by Apple, MAMP, Fink, Macports or Do-it-yourself compiling. I used to use Fink because of it's Debian APT root which I prefere much over the FreeBSD based Macports system. I often had problems maintaining ports and do like the ease of the APT system.

Although Fink has a php shell command too (packet php-cli) it is broken and simply does not run spitting out ugly dyld: Symbol not found: _core_globals_id errors. Trying to fix it by modifying and rebuilding the php-cli package did help but at the same time broke Fink's Apache mod_php (Apache did segmentation fault at every page request).

In the need of having a Drupal development environment available fast I decided to try Macports again. It seems to have a much more vital user community and the ported software is more up-to-date compared to Fink.

Getting Apache2, PHP 5.2 and MySQL 5.0 up and running using Macports is easy if you are somewhat familiar with server administration. Just install the Macports from http://www.macports.org and run sudo port install php52 +apache2 +mysql5 +pear +imap +postgresql83 mysql5 apache2

You may find some installation details in the Web, for instance here:

Getting the MySQL databases from Fink to Macports can be done by first executing /sw/bin/mysqldump --all-databases --opt > alldatabases.sql when Fink's mysqld is running. In a second step import it to Macport's mysqld once it is running by using /opt/local/bin/mysql5 < alldatabases.sql. You need to run /opt/local/bin/mysql_upgrade5 after this to upgrade the databases to the newer MySQL version. Especially this will fix the privilege tables. Without that you may get access errors when accessing the databases from Drupal. Note: mysql_upgrade5 wants to call mysql and mysqlcheck instead of mysql5 and mysqlcheck5. Fix that by symlinking both existing commands to there non-existing counterparts inside /opt/local/bin.