Building and Installing Emacs from Source on Ubuntu

Every so often I have to setup a web development server and one of the first things I have to have on that server is Emacs. As an Emacs fanatic, I need to have the very latest bleeding-edge version. In order to ensure that, I clone the official git repository into my home directory and then I compile and build from there. Most of the time I will be performing the steps below on a Ubuntu Server distribution (these steps work on versions 8.10, 9.04, and 9.10) without X installed.

  1. I will assume you already have your Ubuntu server up and running.
  2. Install some packages needed for the build by running the following command:

    sudo apt-get install build-essential gcc git-core texinfo libncurses5-dev`
    
  3. Clone the latest Emacs from the GNU git repository by running this:

    git clone git://git.savannah.gnu.org/emacs.git`
    
  4. Configure, compile and install Emacs by running the following commands:

    cd ./emacs<br>    sudo ./configure --without-x
    sudo make
    sudo make install
    

Some notes: The need for the build-essentials, gcc, and git-core are pretty obvious; the texinfo package is needed for the make info dependency; and the libncurses5-dev is needed for the termcap.h dependency.

The above will also work on a desktop distro, but you will be limitedto a terminal version of Emacs. In order to install a graphical versionof Emacs you will also need to install the following extra packages:

sudo apt-get install libgtk2.0-dev libtiff4-dev libgif-dev libjpeg62-dev libpng12-dev libxpm-dev

The above line will also install a bunch of other dependencies neededby the libraries. Don't forget to also remove the --without-xparameter and run just this line:

sudo ./configure

Let me know how it works for you.

Comments

Comments powered by Disqus