Table of contents
- Free software = build your software yourself →
- Required dependencies for building emacs on macOS →
- Extra dependencies that will add features to your emacs →
- 8 lines of instructions →
- emacs documentation →
- To use emacs from the command line →
- Updating the code requires 2 instructions →
- Free Software = you can write code and contribute →
- References →
This is Free Software!
Lots of people seem to wonder, "what is the best emacs for macOS"?
Their criteria for "best" being not always clear, the answer I systematically give is: "
Clone the repository and build it yourself. This is free software!"
Since I always forget the dependencies and the steps, this page is a memo for myself, and for curious people who want to try themselves.
Note: I am not a programmer. I just follow instructions. There is nothing magic in the 8 instruction lines that follow. Before, or after you've cloned emacs, you can read the
INSTALL.REPO file where basically everything I write here is found, along with the
README and the
INSTALL files where you'll find additional or redundant information. It's basically all there. I am not making this up.
The dependencies below are the minimum emacs requires, and you can find them by running
./autogen.sh first and then
./configure yourself before using brew to install them: the two scripts will just choke every time they don't find the required libraries.
What I did to come up with that list is just add dependencies until the scripts ran their course without error.
If this is your first "development" attempt, you will need the XCode command line tools, basically because you'll need
git for the whole process.
brew will prompt you about that during its install process, and even if that does not happen, the first time you run
git, for example to clone emacs, macOS will tell you that you need to install them and prompt you with a nice dialog.
The required dependencies are the following:
"Autoconf is an extensible package of M4 macros that produce shell scripts to automatically configure software source code packages."
"Texinfo is the official documentation format of the GNU project."
"Mailutils is a swiss army knife of electronic mail handling. It offers a rich set of utilities and daemons for processing e-mail."
"GnuTLS is a secure communications library implementing the SSL, TLS and DTLS protocols and technologies around them."
I sent the link to this article to the
emacs-devel mailing list for verification and Pankaj Jangid was nice enough to tell me about his own experiences and suggested a list of non-required but recommended packages that emacs would notice during the configuration process. Alan Third, the ns-port maintainer, also chimed in to indicate that some of Pankaj proposed libraries were in fact ignored since the image types they correspond to are handled by macOS proper.
The recomended dependencies are the following:
"This is librsvg - A small library to render Scalable Vector Graphics (SVG), associated with the GNOME Project."
"X11 pixmap library"
"Little CMS intends to be a small-footprint color management engine, with special focus on accuracy and performance."
"Jansson is a C library for encoding, decoding and manipulating JSON data."
If you want to install the above recommended dependencies, you'll need to add a
brew install instruction as shown below.
# install brew # URL: https://brew.sh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"# install required dependencies # or jump to "configure, etc." below and install them one by one
brew install autoconf texinfo gnutls mailutils# install recommended dependencies, but only after you've checked what they do by following the links above...
brew install librsvg libxpm lcms2 jansson# clone emacs # URL: https://savannah.gnu.org/projects/emacs
git clone -b master git://git.sv.gnu.org/emacs.git# configure, build and install emacs
cd emacs ./autogen.sh ./configure make install
Emacs.app now resides in
I don't suppose you'd want to install emacs from scratch without knowing how to use it, but if that's the case, and that's totally OK, emacs comes with thousands of pages of manuals that are just a
ctrl-h i away.
That shortcut means hit the
control key, hold it pressed, hit the
h key, release both, and hit the
i key. That shortcut calls the
info function, which bring up the list of manuals included in emacs.
You can also start a tutorial with
ctrl-h t, which means hit the
control key, hold it pressed, hit the
h key, release both, and hit the
t key. That shortcut calls the
The manuals are online, if you feel more confortable reading in a web browser: GNU Emacs Manuals Online
A few extra settings
If you need to use
emacs from the command line you may need to update your
.profile file with aliases like this:
alias emacs='path/to/emacs/nextstep/Emacs.app/Contents/MacOS/Emacs' alias emacsclient='path/to/emacs/nextstep/Emacs.app/Contents/MacOS/bin/emacsclient' alias ctags='path/to/emacs/nextstep/Emacs.app/Contents/MacOS/bin/ctags' alias ebrowse='path/to/emacs/nextstep/Emacs.app/Contents/MacOS/bin/ebrowse' alias etags='path/to/emacs/nextstep/Emacs.app/Contents/MacOS/bin/etags'
and that's basically it.
Updating the thing
The first time you build emacs, along with installing all the dependencies, etc. might take some time, maybe a good 30 minutes, maybe more. But then, you end up with a configuration where you just need to update the code once in a while, and
make install the thing again to have the latest version running.
Basically, all is needed is to run this:
# inside the cloned emacs directory # update the code
git pull# build and install the new version
And the next time to start emacs, you run the lastest
master branch code.
This it Free Software! 2
The whole point of Free Software is that is gives you the tools necessary to understand what is going on, to learn how to do things yourself and to control your environement.
So, yes, emacs is free software, and now you're all set to play with the code and do your own thing, that will eventually lead to first contribute small things, and then bigger and bigger things to emacs proper.
For that, you just need to create your own development branch and code there:
# inside the cloned emacs directory # update the code, just to have the latest one
git pull# create your development/test branch, for example "myEmacs"
git checkout -b myEmacs# open that new branch in Finder
Everything you do there will never impact the
master branch from which you have built emacs. You can always
git checkout master back to go back to a clean slate (
git will eventually ask you to
git stash away your modifications before switching to
master, so just follow the instructions).
Now, you may want to know a bit more about Emacs Lisp, about
git, about how to contribute to emacs, so here are some references:
- The "Introduction to Programming in Emacs Lisp" is the entry point for Emacs Lisp development. It is available from inside emacs (type
ctrl-h ito find the list of manuals available right at your finger tips) and also online:
An Introduction to Programming in Emacs Lisp
gitcomes with excellent documentation, and a free book too:
- If you want to practice your Emacs Lisp skills, the "Exercism" site has a track for you:
Emacs Lisp on Exercism
- You will quickly find that you need to have a good Emacs Lisp reference to go further. emacs provides you with an excellent reference for pretty much everything you need to know, here again, just a
ctrl-h iaway, but it is also online:
GNU Emacs Lisp Reference Manual
- If you need general help, there is a
help-gnu-emacslist and for development help there is the
emacs-devellist, along with a lot of other emacs related lists, hosted on the emacs development site:
emacs - Mailing Lists
- And here is a tutorial about the procedure to follow if you want to propose your code for inclusion into emacs, by Colin Woodbury:
Contributing to Emacs