Disable all contrib modules in Drupal 8

Author:

If you for some odd reason should need to disable all contrib modules in Drupal 8 in a sweeping motion, you could do with Drush:

Start by getting a list of all modules, that…

  • are enabled
  • are not in core
  • get the machine name
  • and put it all in a file
$ drush pml|grep Enabled|grep -v Core|awk -F"[()]" '{print $2}' > modulelist.txt

Then we put a drush command ahead of every module name and put it in a new file

$ sed 's/^/drush pm-uninstall -y /' modulelist.txt > disablecontrib.sh

Make it executable, fire away and Robert’s your mothers brother.

$ chmod +x disablecontrib.sh; ./disablecontrib.sh

Not elegant but fast and effective.

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.