This is a quick walkthrough of how to somewhat painlessly install the Drupal Shell – Drush.

  1. 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
  2. On the console, type and enter sudo port install drush
  3. 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:

    1. sudo port deactivate php5
    2. sudo port install drush
    3. sudo port -f deactivate php52
    4. sudo port activate php5
  4. 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...
  5. To fix above, download Console_Table of PEAR and unpack it.
  6. 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
  7. 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.

Related resources

  • Drush.org – A command line shell and scripting interface for Drupal
  • Drupal – Open source content management platform
  • PEAR – PHP Extension and Application Repository