Last updated February 4, 2013. Created on April 24, 2008.
Edited by WorldFallz, LeeHunter, hailu, stephthegeek. Log in to edit this page.

Uninstalling a module is easy! Remember to create a backup of your database first. Before deleting the files, it must be disabled.

Disabling a module

  • Go to the modules page appropriate for your version of drupal (ie /admin/modules for d7)

  • Scroll down until you find the modules that you'd like to remove.   

  

  • In this case, you'll want to disable all of the “Views” set of modules. In order to disable a module, click to uncheck the “enabled” checkbox that's next to it. If a module box is greyed out, that means you cannot yet disable it. This is because there is another module that requires that module to be active.

  • In this case, Views RSS and Views UI must be disabled first before the Views module can be disabled. Uncheck those boxes first, then click on “Save configuration”

 

 

  • Once the page refreshes, the checkbox next to the Views module will no longer be greyed out. Repeat the process with the Views module, and everything will be disabled.  

 

Uninstalling a module

Not all modules have specific uninstall functions programmed in. A module will only show up on the uninstall tab if it has this feature. If it doesn't, skip this step and simply delete its files.

  • Click on the “uninstall” tab at the top of the modules page. It will look like this: 

  • Click on the checkbox next to the desired module (in this case Views) and click the uninstall button.

  • Next, you'll have a screen verifying your intention to uninstall this module.  

 

  • Click on the uninstall button again, and you'll get a screen with green text verifying that the module is uninstalled.

Remove/delete module files

Removal of module files is similar to the process of uploading module files.

  1. Use the same FTP client software as used in the uploading process, and use the same connection information.
  2. Navigate to the same directory
  3. Instead of uploading files from your own computer, delete the directory containing the desired module. 

SSH

  1. Use the same SSH client software as used in the uploading process, and use the same connection information.
  2. Navigate to the same directory.
  3. Instead of using the wget command to upload files, use the command “rm -rf [module folder name]”. In the Views example, you would type “rm -rf views”.

Note: a module without an uninstaller may leave tables or fields in your database. A module like this must be dealt with manually in order to completely remove it from your database, which is best practice to keep your site clean if you definitely do not want to use this module again. There may be an obviously named table or set of tables in your database which can be easily deleted, but the only way to know for sure is to examine the module installation file to see what was added in the first place. Always create a backup snapshot of your database before attempting this!

From TopNotchThemes.com

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

pbarden’s picture

Could you elaborate a little more on the last paragraph? I have several modules without uninstallers that I'd like to remove completely.

If they have CREATE TABLE statements in their INSTALL file, it's easy enough to find and delete the tables.

But, what about the cruft that's left in the "system" and "variable" tables?

What are the "best practices" for getting rid of anything related to the module in these tables?

Obsidian1269’s picture

I also would like to know about how to undo the damage from modules without uninstallers. Perhaps there is a way to create uninstallers for modules? My site has a number of unwanted leftovers that would be great to get rid of. Also, how might I find and delete tables left behind?

--
My Drupal Site: http://ratemyskate.com/

mattrweaver’s picture

I'm trying to uninstall as you describe, but on the "uninstall" page, after I check the modules that I want to uninstall and click "uninstall" I do not get a confirmation and the check boxes become unchecked. Nothing is removed. Coincidentally (perhaps?), cron won't run. Any ideas what is wrong?

Finished products are for decadent minds. -- Isaac Asimov

dcmistry’s picture

Tried uninstalling Views UI but it would not let me.
I get the message "Fatal error: Call to undefined function views_get_all_templates() in /Users/dharmeshmistry/Sites/drupal-7.0/sites/all/modules/views/views_ui.module on line 34"

Dharmesh Mistry

sorensong’s picture

I get this: "Error The website encountered an unexpected error. Please try again later."

Weird.

FireMouse’s picture

I think should be changed to "In this example," .

xtiansimon’s picture

If it doesn't go here, I'm can't decide where else it would go.
What I am speaking of is a module management/troubleshooting tips page. Specifically for the situation when you add to an existing site's modules and run into problems.

I did a search of forums and docs and find many instances of similar discussions about individual modules. Most discuss some variation of modules not reinstalling properly. Yet, I can't find any general advise on the issue of data loss (Will my new content types be ruined? Will my custom View become unusable? ) if I enable and then reenable a module to resolve conflicts. Should I just unenable a module or should I completely uninstall (under the uninstall tab) if available? What is actually happening when I uncheck and then recheck a module?

vinay kgupta6’s picture

how to remove module in drupal 7

tchurch’s picture

Drupal 7:
I've been testing this with my own module, to make sure that all information is removed from the database for the module when it's uninstalled.
I've also compared it with another module and have some points:

1) it seems that all modules appear in the uninstall list, even if it doesn't have an uninstall feature (in the .install file or this file is missing).
2) The modules I've looked at (even mine) creates permissions. These are not removed from the database (role_permission) when it's uninstalled but don't work correctly (or show correctly) when the module is enabled again.
There must be somewhere else in the database that holds these permissions because this table hasn't changed.

Can someone shed some light on this? I will also report this elsewhere to try and get an answer.

tchurch’s picture

it seems that it's Toad for MySQL. It wasn't refreshing the data when I reran the query. It seems OK.

I used phpmyadmin instead and it looks OK.

alexkb’s picture

If anyone's wondering (I certainly was), the disable module functionality in Drupal 8.x is disabled by design. The correct way to disable a module is actually to uninstall it - either via the uninstall tab on the modules page, or via drush pmu <modulename>.

W.M.’s picture

@alexkb

Thank you :)

dobie_gillis’s picture

How do I remove a module that is referenced to in the database but has already been deleted from the filesystem?

dobie_gillis’s picture

Kebz’s picture

@dobie_gillis

I just realized you were the last responder mentioning the Schema module. I'm editing out what I wrote previously. It's late here... lol

Anyhoo... that Schema module helped me out with information. I just installed it today, so I'm still trying to figure it out. But my procedure below is my manual version =)

The only way that I can do a clean un-install is by doing the following

  • Disable
  • Uninstall
  • Delete Module folder

Sometimes, the modules will remove itself off the database automatically, if not, then you have to go in and do it manually

  • I go to my PHPAdmin
  • select my database
  • do a search for the "system" table
  • sort and search for the module you want to remove permanently
  • Delete and then flush the table

Then sometimes, they leave traces behind, hidden within other tables and modules that may be bundled, dependencies, etc

  • Select the database again ... be sure to search ALL of the tables
  • search for the module name
  • For example, "Membership_Entity" creates its own table .. so anything related to membership and the search has to be the "exact phrase". If there's any lingering around, you'll get it in the search results.

Once it provides you the locations, then you have to look inside each one and see if the right module name or association of is correct.
Delete and Flush

I just did this a few hours ago... again... sigh! So this is why it is fresh in memory.

Good luck to you or anyone else trying to achieve this =)

~Kebz