Installing Drush on Mac OS X the developer way
This is a quick walkthrough of how to somewhat painlessly install the Drupal Shell – Drush.
- If you don't yet have MacPorts and you're a Mac-based developer, install it. It'll come handy on more than once scenario. See the installation instructions
- On the console, type and enter
sudo port install drush
- You're likely to get a following error:
execute port: Can't install php52 because conflicting ports are installed: php5
To fix the error disable php5, install drush and re-enable php5:sudo port deactivate php5
sudo port install drush
sudo port -f deactivate php52
sudo port activate php5
- If you try to run Drush after MacPorts has finished installing it, you'll get a following error:
Drush needs a copy of the PEAR Console_Table library in order to function...
- To fix above, download Console_Table of PEAR and unpack it.
- Copy the Table.php of the package into the Drush location, e.g. with
sudo cp /Users/[your username]/Downloads/Console_Table-1.1.5/Console_Table-1.1.5/Table.php /opt/local/libexec/drush/includes/table.inc
- Set the appropriate rights for the copied file with
sudo chmod 0644 /opt/local/libexec/drush/includes/table.inc
Now as you fire away with drush
on the command line, you'll get all the possible options and commands of it. It works.
Tip: to use Drush, navigate to the Drupal modules' folder, e.g. cd /Users/[your username]/www/drupal.yoursite.com/sites/all/modules
and use any of the Drush commands, e.g. drush dl views
.