I was reconfiguring my localhost, and needed to install mighty drush (aka drupal shell http://www.drush.org or http://drupal.org/project/drush) on OSX 10.8 Mountain Lion. With a few tips from internets it took only a minute, but digging for that tips took much more of course. So here is a compilation, get your terminal ready.

I assume you've already set your up php.ini, if not, then just run sudo cp /private/etc/php.ini.default /private/etc/php.ini

Most probably you don't have PEAR (http://pear.php.net) installed yet, it's easy to do. PEAR is bundled with 10.8 (and at least 10.7) but just not configured:

sudo php /usr/lib/php/install-pear-nozlib.phar
pear config-set php_ini /private/etc/php.ini
pecl config-set php_ini /private/etc/php.ini
sudo pear upgrade-all

You are now all set to install drush via PEAR:

sudo pear channel-discover pear.drush.org
sudo pear install drush/drush

Done! Fist time you need to run drush as sudo as it needs to install additional library:
sudo drush

Which might make drush cache not writable by your user. So just claim drush for yourself:
sudo chown -R [your_osx_user] ~/.drush

Later on you won't need sudo for drush. Just navigate to you drupal project folder and run it from there.

Add new comment