Now that GNU Emacs 25.1 has been released, it is time for my customary “how to install Emacs 25.1 on a recent Ubuntu” post. In my case I’m using XUbuntu 16.04, but the instructions are pretty much the same for just about every recent Ubuntu version. The package versions of the referenced packages differ, but the package names haven’t changed since I first published one of these posts.

I make sure that the build-essential package is installed, plus to make things easier I’m also installing the build dependencies for Emacs 24. That way the Emacs 25.1 build should have the same options enabled as the official Emacs 24 package you get with Ubuntu.

sudo apt install build-essential
sudo apt-get build-dep emacs24

I already had build-essential installed, but not the build dependencies. Don’t be surprised if apt-get wants to install a fair number of packages as build dependencies – it installed 171 new packages on my machine.

If you do get the following error when you try to run the apt-get build-dep step, you need to add the ‘source code’ repository to your Ubuntu software repositories in Settings/Software and Updates:

E: You must put some 'source' URIs in your sources.list

At the same time, you will want to download the Emacs sources via the Emacs download page and untar it into a convenient directory. Then it’s simply a matter of running ./configure and kicking off the build:

./configure --prefix=$HOME/local
make && make install

I prefer to install my home-built Emacsen and other binaries into a directory tree that is local to my user directory, hence the –prefix argument above. That way, I don’t run into conflicts with system packages.

That’s it, a quick check that we have a working version of Emacs 25.1 and we’re in business:

~/local/bin/emacs --version
GNU Emacs 25.1.1
Copyright (C) 2016 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

Of course I also have the GUI version for the time when I’m not ssh’d into a remote server:

GNU Emacs 25.1 running on XUbuntuHappy Emacsing! I’m off to check out the new features in Emacs 25.

7 thoughts on “How to build GNU Emacs 25.1 on (X)Ubuntu 16.04”

  1. If you use `sudo checkinstall` instead of `make install`, it will build a .deb package that you can install on other machines, and easily uninstall with `dpkg -r`.

    1. That is very helpful, thanks. Might come in very handy when I update the various VMs here that I use for development.

  2. Fails on Ubuntu 16.10 now: ends like this

    Loading emacs-lisp/float-sup…
    Loading vc/vc-hooks…
    Loading vc/ediff-hook…
    Loading uniquify…
    Loading electric…
    Loading emacs-lisp/eldoc…
    Loading cus-start…
    Loading tooltip…
    Loading /tmp/emacs-25.1/lisp/leim/leim-list.el (source)…
    Finding pointers to doc strings…
    Finding pointers to doc strings…done
    Dumping under the name emacs
    Makefile:736: recipe for target ‘bootstrap-emacs’ failed
    make[1]: *** [bootstrap-emacs] Segmentation fault (core dumped)
    make[1]: Leaving directory ‘/tmp/emacs-25.1/src’
    Makefile:398: recipe for target ‘src’ failed
    make: *** [src] Error 2

    1. Paul,

      thanks for pointing this out – I haven’t migrated my Ubuntu VMs to a newer Ubuntu version as I switched to Manjaro Linux.

      This appears to be a known issue and there is a workaround – I’ll create an updated post later. The workaround is to use ./configure CFLAGS=-no-pie [additional options]

Leave a Reply