To download and install a module, I run:

drush dl module_name
drush en module_name -y

I put that in a Bash script function, and just call "drin module_name" to simplify.

function drin(){
  drush dl $1
  drush en $1 -y

Is there a one-line command in Drush to download and enable a module?

  • There is a proposal for several improvements in download and enable. See this issue drupal.org/node/1364814 – jonhattan Feb 8 '13 at 9:18
  • There is an update in the latest drush that does this. See new selected answer. Thanks! – radj Nov 5 '13 at 7:19

The following will download and enable the module:

drush en module_name -y

Edit: The download (dl) command is not needed. When trying to enable a module that is not downloaded yet, Drush will ask if you want to download it and then ask if you want to enable it. The -y automates the "yes" answers to these questions.

This was added in Drush 6.0.0 (#1364814 by eiriksm, jonhattan: Added Extend pm-enable to offer downloading the project for missing extensions.)

| improve this answer | |
  • Can you expand on how this is different than the other answers? – mpdonadio Oct 30 '13 at 22:29
  • 2
    I think this is a new implementation. At the time I posted this QA, this was not possible. – radj Nov 5 '13 at 7:17
  • 1
    This didn't work for me, using a fresh install of drush from the repository. – RevNoah Nov 19 '13 at 19:06
  • 2
    This didn't work. I tried the following: drush en schema -y and got this: schema was not found and will not be enabled. [warning] There were no extensions that could be enabled. [ok] – cdmo Jun 12 '14 at 15:23
  • 1
    Okay, this approach works fine on Drush 6.3.0. – cdmo Jun 12 '14 at 17:35
drush dl module_name && drush en module_name -y
| improve this answer | |
  • 1
    Thanks for this but this is the same as typing in the commands twice, or using a semi-colon to separate them. I was looking for an actual drush subcommand. – radj Feb 8 '13 at 12:44
  • Yes though your original question, before you edited it, was asking for a "single line solution" which it is. – David Thomas Feb 8 '13 at 23:34
  • Yeah, I know. I'm sorry about the confusion. That's why I edited it to clarify and not mislead the next contributors. – radj Feb 9 '13 at 0:55

Downloading and enabling a module can be done with drush en project_name. It asks for a confirmation; if you don't want to confirm, use the -y parameter.

drush en project_name -y

You can download more projects with the same command.

drush en rules views token -y

For a list of some basic Drush commands see Basics drush commands.

| improve this answer | |
  • 1
    Yes, 'drush en' works with more recent versions of drush – David Thomas Nov 26 '14 at 5:53

In Drush 9, you download a module with composer require drupal/module_name.

See the new documentation for Drush 9 on drush pm:download.

After, you will need to enable the module with drush pm:enable module_name.

*Other useful commands for modules are:

  • See all the modules installed

    drush pm:list
  • Uninstall a module

    drush pm:uninstall module_name
| improve this answer | |

in Drupal 8 you no longer use Drush. Use composer require drupal/module_name instead.

| improve this answer | |
  • This downloads it but does not enable it. How do I enable it in command line for D8? – Christia Apr 23 '19 at 10:21
  • 1
    @kiamlaluno I am not sure why it was necessary to edit my comment since there was no substantive change in what you edited. In fact, by changing it you took the command out of its own element which allows users to double click on it to copy and paste it, which was the whole point in why I placed it in a code element in the first place. I understand you're a moderator, but I fail to understand your reasons here. – Jason Dec 13 '19 at 14:20

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