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 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:
  3. 
        sudo apt-get install build-essentials gcc git-core texinfo \
        libncurses5-dev 
    
  4. Clone the latest Emacs from the GNU git repository by running this:
  5. 
        git clone git://git.savannah.gnu.org/emacs.git
    
  6. Configure, compile and install Emacs by running the following commands:
  7.     
        cd ./emacs
        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 makeinfo 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 limited to a terminal version of Emacs. In order to install a graphical version of 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 needed by the libraries. Don't forget to also remove the --without-x parameter and run just this line:

   
    sudo ./configure

Let me know how it works for you.

0 comments: