Is there a command for Drush so I can uninstall a module from the enabled state? I hate having to drush dis mymod -y (and) drush pm-uninstall mymod -y

  • 1
    Drush pm-uninstall exists now. Just do drush pm-unistall module-name – pal4life Jul 22 '14 at 17:14

No, drush was design so you would not uninstall an enabled module. The same way Drupal was. You will have to create your own shell script to run these commands.

If you want to create your own drush command you should read this tutorial and this sample reference

  • This answer is not valid anymore. Just use drush pm-uninstall, just like pal4life said. – Ignacio Segura Postigo Dec 15 '14 at 10:17
  • 1
    @Ingacio can you include version # of Drush that now does this. – iStryker Apr 1 '15 at 12:53
  • 1
    I don't think this is the case. I'm using 7.0-dev and it still prompts me to disabled before uninstalling the module. – Shawn Conn Apr 17 '15 at 17:45
  • The tutorial link is broken, please update your answer. – leymannx Jun 18 '15 at 8:45

Another solution here if you don't want to take the alias route that Tony brought up is to use the && operator to do a one-liner:

drush dis -y my_module && drush pm-uninstall -y my_module
  • This drush && works for me. – louieliu Sep 30 '15 at 2:49
  • For Drupal 8 just uninstall: drush pm-uninstall -y my_module cause Drupal 8 does not support disabling modules. – Achraf JEDAY Oct 17 '19 at 8:47

I'm using Drush 6.2, and pm-uninstall does not appear to disable AND uninstall a module. I thought I'd share another solution/alternative to creating a custom drush command. I was searching for the exact same thing and discovered a method using aliases and a custom bash script.


drush uninstall module_name

In drushrc.php file, add:

$options['shell-aliases']['uninstall'] = '!drushu';

And create a script (add to your $PATH), called drushu with the following:

drush dis $1 -y
drush pm-uninstall $1 -y

If in a multi-site environment, site aliases would likely be required. Tested and works using the following... Example:

drush @site-alias uninstall module_name

In drushrc.php file, add:

$options['shell-aliases']['uninstall'] = '!drushu {{@target}}';

And in the drushu script, add:

drush $1 dis $2 -y
drush $1 pm-uninstall $2 -y

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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