The Second Draft

By Ashton Wiersdorf

Write one to throw away.

About | Résumé

GitHub | Matrix | Twitter

22 July 2020

Transitioning to GUI'd Emacs on macOS

I went on an adventure today. I left behind the stable comforts of the terminal and compiled bleeding-edge Emacs that uses a native window system.

This is a big deal for me. As long as I can remember, I’ve used Emacs from within a terminal. I’ve decided to give the GUI’d Emacs a whirl.

My Journey

I’m running macOS Catalina (10.15.5). Originally I tried using the pre-built packages via brew (brew cask install emacs) and those available at Emacs for Mac OS X. However, all these pre-built binaries crashed on Catalina. I guess it’s a problem with Catalina. 🙄

So, I decided to try building from source. I cloned the Emacs source code directly from Savannah:

$ git clone https://git.savannah.gnu.org/git/emacs.git

I cd’d into that directory:

$ cd emacs

At this point you’ve got the bleeding-edge development Emacs. You might want to check out and pull a different branch or tag. I decided to check out the native-compilation branch:

$ git checkout feature/native-comp
$ git pull origin feature/native-comp

(I’m pretty sure those are the right commands; stuff got a little funky while I was building.)

I exported a magic1 environment variable that I got from a helpful Emacs StackExchange post:

$ export LIBXML2_CFLAGS="-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2"

After exporting that variable, I ran configure:

$ ./configure

Then I ran make:

$ make

That will create a binary at src/emacs that you can run to test to make sure that all is working as it should. If you’re satisfied with that emacs configuration, you can bundle it up into a stand-alone application:

$ make install

This will create Emacs.app inside of the nextstep/ directory. You are free to move that around:

$ mv nextstep/Emacs.app /Applications/

I also went into System Preferences > Security and gave Emacs Full Disk Access. I heard of some people having difficulty accessing iCloud files from Emacs and this cleared it up. I haven’t had any difficulty—I just wanted Emacs to have full access anyway.

Niceties

I still use the terminal a lot (though I might use it less directly if I can get comfortable with ansi-term mode) so I made a few shortcuts for myself:

Conclusion

Why did I do this? Because I was a little bored. I also wanted to experiment with some of the more extensive key binding opportunities that a full-bodied Emacs offers.

I’ll write updates to my blog as time goes on. I might decide to switch back to regular-old Emacs in the terminal. Right now, however, I’m enjoying the GUI’d version.

You can see my Emacs config on my GitHub. Feel free to drop me a line if you have any questions.

UPDATE 2020-07-23

After using Emacs 28.0.5 for a day, here’s what I came away with:

In short, I’m finding this switch a decently comfortable one. I’m not giving up very much, and I’m gaining a decent amount. I’ve had some difficulty getting all the colors in the theme how I like them—I might just give up for a bit and see if I get used to them.

  1. I’m not entirely sure what it does. I know that it didn’t work before using this environment variable, and now it works after I tried using it. 

tags: emacs