How to rebuild ELPA packages after upgrade of Emacs

Thomas picture Thomas · Jul 13, 2014 · Viewed 14.4k times · Source

I just upgraded GNU Emacs from 23 to 24 on MacOS and some ELPA installed packages stopped working. One of them is AucTeX. Deleting it and reinstalling it through the package manager made it work again, but I don't want to do this by hand for every package. I'm slightly confused that I find nothing about that on the Internet.

Don't the .elc need to be recompiled for a new version of Emacs? Why isn't this a feature of package.el?

Answer

lunaryorn picture lunaryorn · Jul 14, 2014

You do not need to re-install all packages. The packages itself are likely fine, however, they need to be re-compiled, because Emacs Lisp byte code is generally not compatible across major versions.

To re-compile all packages, type M-: (byte-recompile-directory package-user-dir nil 'force). After restarting Emacs, packages should work fine again.