An easy example is adding themes-megapack to dotspacemacs-configuration-layers in .spacemacs, then running SPC f e R, and then observing all the added *-theme packages in your package-selected-packages list.

After commenting themes-megapack out of your dotspacemacs-configuration-layers list, then doing SPC f e R and even SPC q r, all the *-theme packages remain, and executing package-autoremove reports "Nothing to autoremove".

How to I clean up all these orphaned packages?

1 Answer 1


If you did not touch the variable dotspacemacs-install-packages i.e. its value is still 'used-only, then the packages do get removed (i.e. 'physically' from the elpa directory). However, the variable package-selected-packages does not get 'updated' so that it still also shows the uninstalled packages. I guess this could be considered a bug, so you could report it as an issue.

I have only very quickly had a look, but at first glance it looks like doing M-: (package--save-selected-packages (package--find-non-dependencies)) sets the variable to the 'correct' value again (I could be wrong, but I certainly don't expect it to do any harm, as package management is fully 'controlled' from the dotfile).

  • Awesome, I'll file an issue!
    – mcp
    Commented Jan 6, 2022 at 17:02
  • I guess it could help if you refer to this answer. I must say, that I think this really seems a non-critical bug to me, and I guess maintainers will focus on fixing more urgent bugs. But anyway, good to have an issue for it (so it is documented)... it will be very much appreciated... Commented Jan 6, 2022 at 21:54

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.