How to compile Emacs feature/native-comp on macos

I was finally successful in compiling and running the feature/native-comp build of Emacs! This was my second try, after having failed the first time several months ago. This new build promises huge performance improvements which I’m very much looking forward to enjoying in my day-to-day use of the best editor on the planet :)

Since it took me two tries and several hours of hacking to get this working, I figured it would be useful to write down the winning recipe for others so they might have an easier time of it. The process is not complicated or very long, but there are a couple steps that are not obvious in the documentation I’ve seen, and a couple hangups you might run into that prove difficult to resolve.

I’m running macOS Big Sur.

Build

  • 1. Clone build-emacs-for-macos
  • 2. cd to that directory
  • 3. Run brew bundle
  • 4. Check that you have Ruby version at least 2.3 by running ruby --version
  • 5. Run ./build-emacs-for-macos feature/native-comp

Run

  • In your emacs configuration file, init.el or other, put (setq comp-speed 2) somewhere near the top.
  • In the build-emacs-for-macos directory there will be a folder called builds. In that folder there will be a single .tbz file. Open the Finder and double click on that file to unzip it. It will unzip to a new Emacs application in the same folder.
  • Double click the new Emacs application to run it.
  • On first startup, Emacs will compile to native code elisp files for builtin packages and packages that get loaded by your configuration. You can see the progress by switching to the *Async-native-compile-log* buffer.

Notes

  • Since the feature/native-comp branch builds Emacs at version 28, there may be some breaking changes that will require some updates to your config. For example I ran into a problem caused by a change in the API signature of some macros. The version of evil-mode that I was using was slightly out of date and so I had to pull the most recent updates before Emacs would start successfully.
Matt Roll @mroll