I observed that by default "drush dl module_name" installs the latest version possible may it be dev version available.

How can we install a specific version of a project with Drush?

up vote 7 down vote accepted

To download a specific version of a project, specify the 'project name', followed by a dash, then the version name. The -y argument answers "yes" to any and all prompts.

The exact 'project name' for a module, is what is included in the URL of the module on D.O., i.e. everything following the last '/' in the URL. So for the Organic Groups module, that would be og, because its URL is https://www.drupal.org/project/og.

As an example, consider something like this:

drush dl og-7.x-1.3

With this command, you download the Organic groups module (replace it with your "module_name"), and more specifically the 7.x-1.3 version of it (replace it with the "version" you want).

You can also specify a development version of a module, as in this exmple (which would download the current 7.x-2.x-dev version of Organic Groups):

drush dl og-7.x-2.x

For many more details, samples, etc, refer to http://www.drushcommands.com/drush-6x/pm/pm-download and/or http://www.drushcommands.com/drush-7x/pm/pm-download. Or to Installing a specific version of a project with drush.

After you downloaded the specific version, you "enable" the module as per the normal Drupal procedures to do so.

If you want to also enable the module using Drush, then there is no more need to specify the version of the module. To continue the above example, to enable the 7.x-1.3 version of it (after you down;oaded it), use a command like so:

drush en og

If you don't know the specific version that you want to download, you can use the --select option, and Drush will prompt you with all of the most recent available versions:

drush dl devel --select

Add the --all option for a comprehensive list.

You can also see this list without downloading via drush pm-releases devel.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.