I believe, there are three ways to build emacs on osx --- x11, ns (nextstep?), and cocoa. Can anyone explain what the build options mean / the difference between these three are?
1 Answer
There are a number of Emacs versions for macOS, including:
The official Emacs on macOS is build using the "NS" port, also known as the "cocoa" port. As the name suggests, this port of Emacs originates in Emacs for the NextSTEP operating system and has been the official Emacs GUI on macOS since Emacs 23.
Mitsuharu Yamamoto-san maintains the "Mac port" of Emacs. It provides an alternative GUI with a different feature set compared to the NS port. This originates from the Emacs port to Mac OS 8/9 and the "Carbon" port of Emacs 22. (This port is also referred to as the "railway cat" Emacs, as this is where the
brew
recipe is hosted.)Aquamacs is based on the NS port of Emacs and contains a number of enhancements making it behave more like traditional macOS applications.
X11: It is possible to build Emacs with the same GUI as used on X11 system, however it requires a X11 server to run. Unfortunately, the end result will not have macOS look and feel -- things like menus looks as though you were running on a unix-like system. In fact, this is not one GUI but a family of GUI:s as it's possible to build using different X11 support libraries like GTK+.
Terminal only. This gives you an Emacs that only can run in a terminal window, much like a GUI Emacs behaves when passed the
-nw
option.
So, which should you pick?
If you are lazy, pick the official Emacs -- you can download a prebuilt version from https://emacsformacos.com.
If you want to spend some time on getting the best Emacs for you, try both the official Emacs and the "mac" port. Overall, they are fairly similar but provides a slightly different feature set.
Generally, I would not recommend using the X11 port as you wont get macOS look and feel, however in some situations it might be of interest:
- You want a feature only available in the X11 port, like support for
xwidget
- You are accustomed to X11 and want the exact same look and feel when using Emacs on macOS
- You want a "reference" implementation of Emacs, e.g. when contributing to the NS port of Emacs.
-
you might also need the x11 variant if you are installing it on a remote host you're ssh-ing into :-) Feb 28, 2020 at 15:54
-
What about Doom Emacs or Spacemacs ? Could you update the post to include them ? Oct 31, 2021 at 6:28
-
@LudovicKuty, unfortunately no, since I don't know anything about them. However, I think that they are independent of the Emacs variant used and only change things on the lisp-side. Oct 31, 2021 at 12:24
--with-ns=no --with-x
as part of the command line options. I mention this just in case anyone else is interested in building the x11 version on OSX. I would imagine that the accepted answer will include a mention of the materials needed for a successful build -- e.g., XQuartz (The X Window System), etc.--with-ns
don't work in the x11 version, so I haven't really been able to use the x11 productively yet. I would need to learn how to configure alternative keyboard shortcuts in x11 -- the Linux users would probably be right at home with the x11 version, but I'm kind of lost.