In Drupal 7 it was possible to disable modules via admin interface or via Drush drush pm-disable. In Drupal 8 the checkboxes are greyed out in the admin interface and Drush is not able to disable them via pm-disable? How do I disable modules in Drupal 8 with Drush or via admin UI? Or do I need Drupal console for such tasks?

(Sorry for the confusion caused by using the word "programmatically" mistakenly, it was referring to the meaning of "via command line")

3 Answers 3


You can also use drupal console https://drupalconsole.com/ and simply use the command

drupal module:uninstall token

And for install

drupal module:install token

Like the admin interface in Drupal 8 states in the message area, the paradigm and concept of how modules get installed and disabled has changed in Drupal 8, since there were many problems involved in the way how it was before, because of Database left-overs and data inconsistencies while disabling and enabling modules, etc.

Therefore users are encouraged to rather uninstall modules than disabling them now in D8. This doesn't mean the modules are gone or removed from the Drupal root, but they are completely removed from the database including their configuration.

Try drush pm-uninstall module-name instead and you will see the desired effect you are after.

The checkboxes are greyed out to be still able to enable and install inactive modules the way known from D7. But you can't disable them this way no more. And uninstalling should not be provided by checkboxes, since this would be to dangerous.

Look twice in the admin interface: You will find a new tab for uninstalling modules too.

  • 2
    How to do that programmatically in php (for ex: in a MODULE.install) Commented Nov 10, 2016 at 13:08
  • Answer below tells you how to programmatically uninstall modules, no disable in Drupal 8.
    – Duncanmoo
    Commented Nov 15, 2017 at 9:25
  • This should be asked in another question. The answer below has nothing to do with the topic of the question on this site.
    – jbitdrop
    Commented Dec 2, 2017 at 3:06
  • @jbitdrop – It had until you changed the title.
    – leymannx
    Commented May 23, 2018 at 13:12

As the question asks for programmatically and that's why I came here in the first place I'll add a working code snippet to be placed inside MYMODULE.install:

 * Uninstall Field UI.
function MYMODULE_update_8001(&$sandbox) {


  • 1
    This should be asked in another question. The answer has nothing to do with the topic of the question on this site.
    – jbitdrop
    Commented Dec 2, 2017 at 3:07
  • 1
    @jbitdrop - After you changed the question title it doesn't seem to fit anymore, yes. In your post you still ask how to disable modules programmatically.
    – leymannx
    Commented Dec 2, 2017 at 6:00
  • You are right, but it was exactly the other way around. After reading your answer I realized that my question is maybe misunderstandable (sorry, not native tongue). That's why I changed the title to make it clearer. But as you can see from my explanation in D7, I was after the Drush command and things like that, not how to prepare a module for uninstall routines. I am sorry for causing the confusion. Maybe I should ask the fitting question somewhere else again and move your answer over there :) (PS: If programmatically is the wrong word, I have to replace it in the post too)
    – jbitdrop
    Commented Dec 2, 2017 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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