Drush, locally on your mac.
Lately I've been using Drush (http://drupal.org/project/drush) more and more to help me manage my Drupal projects. It works great on my Ubuntu machine and well on our CentOS production server.
I wanted to be able to run it on my old school Titanium mac. But it is still running OSX4 and php was a little outdated. What to do? Upgrade of course, but it wasn't quite as simple as that.
Drush needs to use php from the command line (cli). After downloading it and running ./drush from within the drush directory I was immediately told, "Your php version is too old.".
Running php -v showed me that I was still on php 4 while drush needs 5.
Luckily, entropy php makes upgrading easy. You can get upgrade packages for your mac from http://www.entropy.ch/software/macosx/php/ . I used the last one, php 5.2.4 for Apache 1.3. I followed some instructions found at http://maestric.com/doc/mac/upgrade_php5_tiger to make sure I wasn't hosing things up too bad. After backing up my conf files all I did was unpack and run the entropy package. PHP was upgraded.
Running drush again still gave me the error though. The problem was that even though the entropy package updated which php was used by apache, the cli was still trying to use mac's normal php. The entropy package does not replace the php that comes standard in tiger or leopard.
The new version of php that entropy installs is located at /usr/local/php5. In order to get drush to use that one instead, I added that directory to my path in front of /usr/local/bin where the old php executable is located. That way when you run php at the command line it will find it in the php5 directory first and use it.
You can edit your .bash_profile file located in your home diretory to achieve this. I also alias the drush command in that file so I can run it from anywhere. My file had these two lines in it when I was finished.
export PATH=/usr/local/mysql/bin:/usr/local/php5/bin:/usr/local/bin:$PATH
alias drush='/Library/WebServer/drush/drush'
You may have to close your terminal window and re-open it after saving your profile to make sure it takes effect.
To test, run php -v to see what version you pick up now. If you aliased drush, you can try calling it from anywhere by just typing drush and hitting enter.
- jimmynash's blog
- Login to post comments
