What's new in Drush 5?

During the DrupalCon Denver this week, there was a presentation by Moshe Weitzman, Jonathan Hedstrom, Owen Barton and Mark Sonnabaum. With it the stable version 5 of Drush should have been released (I might be a little early for that).

Drush is your friend, if you are a developer, you have to have it installed, so I will assume that you have used Drush 4 before and I will present you the new features of version 5 in this article.

Configuration location

Configurations, through drushrc.php files, can now be placed at several locations:

  • Relative to the unix user: ~/.drush/drushrc.php
  • Relative to the Drupal site: sites/{default|example.com}/drushrc.php
  • Relative to the server: /etc/drush/drushrc.php

Shell aliases

You can now provide your own drush aliases in the configuration, for example:

$options['shell-aliases'] => array(
  'pull' => '!git pull',
  'pulldb' => '!git pull && drush updatedb',

So you can set drush commands along with system commands like git or rm.

Options handling

Unrecognized options now output an error, no more "Why this didn't work?", syntax errors can be avoided easily.

Drush help adopted a standard for option parameters:

  • --option=<value> for mandatory parameters
  • --option=[value] for optional parameters

Windows compatibility

Finally! Yes, they did a good work... Sponsored by Microsoft itself, an installer is now available, and (almost) no need of cygwin anymore.

Usage tracking

It is now possible to log used commands, they can be anonymized and sent to MongoLab (sponsor of Drush developers) to make Drush better.
This can also be used by sysadmins to keep track of what developers do.
This option is disabled by default.

Drush make

The famous packet manager integrates Drush core, is it now possible to create .make files out-of-the-box to install modules and themes faster and faster.
That's not all of it, multiple downloads are now handled with concurrency (4 processes by default), more speed!
Moreover, if you didn't know it, there is a Drush cache that prevents downloading tarballs if they have already been downloaded earlier.


Yes, ladies and gentlemen! Site aliases, commands, shell aliases, options and modules autocompletion is now available. A context handling prevent the overflow of possibilities. For more information, the better is to test it or to watch the video.
To enable it you just have to copy-paste drush.complete.sh into /etc/bash_completion.d, or, if you don't have the permissions, you can include a little snippet in your ~/.bashrc

Some options are there so you can even do without the drush keyword at the beginning of the command, for example:
@mysite dl views

Built-in WebServer

Drush 5 comes with a light HTTP server to execute Drupal sites. You may "what is this for", well, if you want to test a Drupal site without wondering about Apache VHosts, this command is very useful. In addition to seeing access log, it also shows watchdog messages.
Thus, the command drush run-server :8889/ will open a page in your browser with the current Drupal site. This requires php-cgi and PHP 5.3.

There is more, you can now do a disposable Drupal with the command quick-drupal. It's perfect if you want to impress this Joomla "friend" you have in few seconds :
cd /tmp
drush quick-drupal

It will download Drupal 7, create a SQLite database (in a single file), and run standard install profile. You can then play with the multiple options:
drush qd "My store" --core=commerce_kickstart --profile=commerce_kickstart --yes --watchdog (enjoy watching your friend having a heart attack)

When you don't need it anymore, rm -r the directory, au revoir.

At this point, I must confess I clapped alone at home...

Queue API

It seems that the new Queue API handling in Drupal 7 is a bit too hidden and only runnable within the cron, Drush solves this problem with two commands:

  • drush queue-list lists all queues registered by modules
  • drush queue-run runs these queues


For people working with multisites, it can be frustrating to execute a command in the wrong site (say sites/default), Drush 5 provides the commands drush site-set and drush site-reset to make this environment persistent.

So lots of new features, and what features! A little tip: to enjoy fresh features from Drush, clone the repository directly. These new features come along with some bugs and that would the reason why the stable version is still not here, but anyway: Kudos to them all!

"We'll see you on the command line" — Moshe Weitzman

The presentation video is available here.

Subscribe to RSS - DrupalCon