I want to upgrade my emacs from 27.1 to 28.1, and I am afraid to break things. I saw on the discord channel that quite a few people ran into problems when upgrading and installing doom.
Does anyone have the proper prescription for safely removing and installing emacs and then installing doom so that everything works fine?
It would be helpful to understand how to uninstall emacs properly, and then install it with doom.
You may encounter errors after up/downgrading Emacs. Run $ doom sync on the command line after changing the installed version of Emacs. If you’ve changed the major version (e.g. 27 → 28 or vice versa) run $ doom build too.
$ doom sync will re-index any built-in/site loaddef files. This is especially necessary if paths to built-in libraries have changed.
$ doom build will recompile all your installed packages, which is necessary because Emacs bytecode not generally forward compatible across major releases (e.g. 27 → 28). Alternatively, reinstall all your packages by deleting ~/.emacs.d/.local , then run $ doom sync .
TL;DR version: run $ doom build && doom sync after up/downgrading Emacs.
That depends on how you installed Emacs and has nothing to do with Doom.
Presumably, since you’re on MacOS, you’ve installed Emacs either with homebrew, macports, or by downloading it from https://emacsformacos.com/ (which you should not do, because this version of Emacs is known to cause issues).
Thanks again!
But what if I do not remember if I installed emacs from https://emacsformacos.com/ or with homebrew? Is there a way to find out?
I have two machines with emacs and I think that one was installed with homebrew and the other from https://emacsformacos.com/.
In case emacs were installed with homebrew, then if I simply run brew upgrade it would upgrade my emacs? Don’t I need to run something like brew upgrade emacs?
$ brew upgrade will upgrade all packages installed with homebrew. $ brew upgrade emacs would upgrade only Emacs. Either will work. Which you prefer is personal preference.
There is likely a brew sub-command that’ll tell you that, but I’m not a macOS user, so I couldn’t tell you off the top of my head.
That said, here’s one quick way to tell: run $ which emacs. It’ll tell you where the emacs executable lives, and if that happens to be in a sub-directory of /usr/local/Cellar/, then it was installed by Homebrew. Any other result (including emacs not found) indicates it was installed another way.
After running brew upgrade I got the following message:
==> emacs-plus@27
Emacs.app was installed to:
/usr/local/opt/emacs-plus@27
To link the application to default Homebrew App location:
ln -s /usr/local/opt/emacs-plus@27/Emacs.app /Applications
If you wish to install Emacs 26 or Emacs 28, use emacs-plus@26 or
emacs-plus@28 formula respectively.
To start d12frosted/emacs-plus/emacs-plus@27 now and restart at login:
brew services start d12frosted/emacs-plus/emacs-plus@27
Or, if you don't want/need a background service you can just run:
emacs
So apparently I am configured to emacs 27 specifically.
I tried to uninstall emacs to install it again, but I got this error.
% brew uninstall emacs-plus
Error: No such keg: /usr/local/Cellar/emacs-plus
Ah, my bad. I forgot Homebrew symlinks them. If you run $ readlink $(which emacs), it will likely resolve to a path under /usr/local/Cellar.
This is getting further away from Doom and deeper into MacOS territory. I can only guess at this point, but try $ brew uninstall emacs-plus@27. Or $ brew cask uninstall emacs-plus? Not even sure if brew cask is still a thing.
Maybe we should take this to our Discord. At this point it’ll just be trial and error the rest of the way.
You are completely right! $ brew uninstall emacs-plus@27 managed to uninstall, and then $ brew install emacs-plus did the trick! I now have emacs-plus 28 installed. And I also managed to simply install doom by running doom build and doom sync as you said.