68

This is strange, the list-packages buffer shows "available" as the status for some packages that are actually installed. Shouldn't that column show "installed" for them? When I click on one, a new buffer opens to inform me that the package is installed, but offers no uninstall option. By comparison, other packages I do not have installed show as "available" with an "install" option next to them.

How do I uninstall an installed package? The one I'm currently looking to axe is smooth-scrolling.

johnbakers
  • 24,158
  • 24
  • 130
  • 258
  • See also http://stackoverflow.com/questions/16469600/how-to-remove-an-installed-package-in-emacs-ver-24 which I have nominated as a duplicate, but which has some potentially useful remarks. – tripleee Nov 06 '15 at 06:23

5 Answers5

59

For Emacs 25.1 and above, the command

M-x package-delete

raises a prompt with autocompletion into names of packages you have got installed.

mmw
  • 740
  • 8
  • 12
56

The package menu shows all known versions of a package.

As such, you may see an installed package listed as available as well, for instance, if there is a newer version of the same package available, or if the same package is available from different archives.

To delete such a package, simply scroll down in the list, or use C-s <PACKAGE-NAME> to search for occurrences of the package. Once you find the installed version of the package, press D to mark the package for deletion; if this fails, press d. You should see a D mark in the left before the package name. Press x to execute the action and actually delete the package.

miguelmorin
  • 5,025
  • 4
  • 29
  • 64
  • 1
    the problem is that when I press D there is no mark next to it, even though it is installed. – johnbakers Dec 12 '13 at 13:03
  • 1
    @OpenLearner Did you press `D` on the package version marked as **installed**? It won't work on the version marked as *available*. –  Dec 12 '13 at 13:39
  • none of them show as "installed" in the actual column in the list, even though this package is in fact installed and says so when you click on it. – johnbakers Dec 12 '13 at 13:43
  • Not sure, but it sounds like there is an Emacs bug here, or at least room for an enhancement request, to make the UI clearer. If you think so, consider reporting it, via `M-x report-emacs-bug`. – Drew Dec 12 '13 at 17:11
  • 4
    @OpenLearner scroll to end to get installed sign, you may find latest version of this package which is not installed, besides, press d instead D – netawater Jun 05 '15 at 08:41
51

I like to use the poor's man solution for that: just remove the directory for the unwanted package in ~/.emacs.d/elpa/ (or the directory specified in your package-directory-list).

EDIT: this solution is intended for scenarios where something went wrong (maybe a bug, maybe the result of manual tinkering with packages' data). Please use @lunaryon answer; it is the right way of doing this on the 99.9% of the cases.

juanleon
  • 9,220
  • 30
  • 41
  • 1
    my concern for this is that isn't there another file somewhere showing *what* is installed, that would not be a part of the directory itself? Surely emacs must know what it is supposed to load if that information is not always in the .emacs file – johnbakers Dec 12 '13 at 13:01
  • 6
    There is no such file. `package-initialize` scans your configured directories in `package-directory-list` for packages. `package-load-list` is used, and autoloads do the "magic" part. Typically what @lunaryorn suggests should do the job, but removing the directory is a safe alternative when you find problems. – juanleon Dec 12 '13 at 13:16
  • thanks! I installed `package-filter.el`, then just found lots of things got broken, including the package manager, so no `d` -> `x` nor anything, except this solution. – ryenus Nov 11 '14 at 13:13
  • My variable `custom-set-variables` in init.el also has some settings about the package I want to remove. "If you edit it by hand, you could mess it up, so be careful", it says. – Gauthier Jun 08 '17 at 06:46
24

I've just uninstalled django-snippets packages by

M-x package-list-packages
C-s django-snippets

Mark the package for deletion by typing d. Execute by typing x.

Exactly the same thing as removing the related directory inside ~/.emacs.d/elpa/.

NB, for the recent emacs, the command is list-packages (instead of packages-list-packages)

Nsukami _
  • 777
  • 1
  • 11
  • 15
14

I found it by chance: bring on the package list, find the package(s) you want to remove, and press 'D'. When you are done, press 'X' and it will remove the packages. It works exactly like when installing new packages, except that you replace the 'I' by 'D' (I think 'D' stands for 'delete').

S4M
  • 4,561
  • 6
  • 37
  • 47