Building Emacs from Source on Yosemite

I just did a clean install of Yosemite. While reviewing my previous posts on getting up and running, I noticed some errors/missing information while following my own directions. I’ve edited those posts for clarity/omissions; however, my previous method of installing emacs via homebrew has been superceded by building it from source. This post details the steps to do so. It takes a bit longer, but allows me to keep up with current development. Caveat: following the master git repo of any software can potentially lead to a unstable/unusable build.

Also, rather than try to install every possible thing to cover every possible use case, I’ve moved to installing things as necessary. I’m a newbie to emacs, so my previous homebrew install of the Cocoa app included just about every possible configuration option; this one is much more minimal.

1. Prequisites:

-Xcode
-git
-imagemagick (allows image viewing)
-gnutls (allows communication via SSL, TLS, amd DTLS)
-autoconf
-automake

Git, imagemagick and gnutls can all be installed via homebrew. The last 2 no longer come bundled with Xcode so must be manually installed. This can be done either through brew install autoconf and brew install automake, or by compiling from source:

autoconf:
cd /tmp
curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
tar xf autoconf-latest.tar.gz
cd autoconf-*/
./configure
make
sudo make install

automake:
cd /tmp
curl -O http://ftp.gnu.org/gnu/automake/automake-1.14.tar.gz
tar xf automake-1.14.tar.gz
cd automake-1.14
./configure
make
sudo make install

2. get the source:
git clone git://git.savannah.gnu.org/emacs.git
cd emacs

3. build Emacs.app:
make configure
./configure –with-ns CFLAGS=”-I /usr/local/include/libxml2″

(As of 22 June 2015, –with-ns is no longer necessary)

./configure CFLAGS="-I /usr/local/include/libxml2"
make install

open -R nextstep/Emacs.app

Drag this to Applications to find in Launchpad.

updating and rebuilding:
# discard stuff from last build
git reset --hard

# delete all of the last build stuff
git clean -xdf

git pull
Delete the app from Applications, then follow steps from #3.

References:
Building Emacs 24.4 from Source on the Mac, Spike Ilacqua.
Build Emacs for OSX, Sebastien Gross.
Building Emacs from Git Repository, Xah Lee.
Configure with libxml2, by Irreal.

comment by Offby1, referencing:
commit d97fbcbedce8f36050af7a55d34c6ed50c99507c
Author: Glenn Morris <rgm@gnu.org>
Date: 2015-06-22 22:03:33 -0400
* configure.ac (--with-ns): Enable by default on OS X.

This entry was posted in emacs, local.config. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *