Ubuntu 16.04: Build Emacs

If you use the same .emacs and .emacs.d with on multiple machines, Emacs version must be the same version with on multiple machines. Especially if you use package-list-package. This article will describe building and installing Emacs. Emacs version is 24.4.

1 Install packages for building Emacs

Install package for building Emacs. Running "apt build-dep" needs a setting of deb src.

$ sudo apt build-dep -y emacs
$ sudo apt install -y libncurses5-dev

2 Download Emacs

Download Emacs from GNU page.

$ wget https://ftp.gnu.org/gnu/emacs/emacs-24.4.tar.xz

3 Build and install Emacs

Extract Emacs.

$ tar xf emacs-24.4.tar.xz
$ cd emacs-24.4

Install Emacs to /usr/local is as below.

$ ./configure --without-x
$ make
$ sudo make install

Install Emacs to $HOME is as below.

$ ./configure --without-x --prefix=$HOME
$ make
$ make install

If another Emacs is installed, you need to add directory to PATH for searching Emacs which is built and installed.

$ export PATH=/usr/loca/bin:$PATH # PATH=$HOME/bin:$PATH