Build and install Emacs24 on Debian squeeze

Hacking in Debian is so easy (one of the reasons I switched). Take, for instance, building Emacs. This is such a piece of cake compared to the weird hoops you have to go through to get all the build dependencies on other platforms. It’s something I never tried before, simply because it was too daunting trying to figure out all the packages I need to install. But apt-get has this awesome –build-deps switch…

So then, how to build and install Emacs 24 on Debian squeeze, in 6 easy steps? Since Emacs24 is not yet released, there isn’t a package for it in Debian (which is why I’m building my own). But I figured that the build dependencies would not have changed too much from Emacs23, so I used that, and it worked.

  1. Install the build dependencies:
       # apt-get build-dep emacs23

    This installs all the compilers, parsers, development libraries and other parts of the GNU toolchain that is needed to build the emacs23 package.

  2. Download the source code. I used the GitHub mirror of the official GNU Savana codebase, and downloaded the newest PKzip archive from there. There is probably a newer one now. Purists probably would check-out direct from either Savana or GitHub rather than download a zip archive… I’m not going to hack emacs itself though, so I don’t care.
  3. Unzip the archive and generate the configure script (the autogen step is skipped in the INSTALL file by the way, good thing I’ve done my homework):
       $ unzip
       $ cd emacsmirror-emacssnapshot
       $ ./

  4. Follow the INSTALL instructions:
       $ ./configure
       $ make

  5. Test it (Note:- if you watch the build, you'll see that after the C core of emacs is built, emacs itself is used to compile the elisp components, so building also makes a fairly good test of the C parts anyway):
       $ src/emacs -Q

  6. If okay, install it:
       # make install


8 thoughts on “Build and install Emacs24 on Debian squeeze

  1. Thanks guys 😉

    You know, I tried this repo first; added the APT key and both the stable and unstable sources, and then “aptitude Install emacs-snapshot”; but it kept telling me that it’s not a real package, or something? I will have to have another play…

  2. Okay then, I’ll have another go (disable unstable first).

    Although I’ll admit: a strong reason to build from source code was for the Star Wars moment when typing C-h C-a and seeing

    “GNU Emacs (i686-pc-linux-gnu, GTK+ Version 2.20.1)
    of 2012-01-11 on archimedes”

    which loosely translated may be read as: “I see you have constructed a new emacs… your skills are complete.” 😉

  3. It’s just as easy on Mac OSX. The magic it seems is not in the –build-deps switch but in Emacs packaging of everything needed to compile and run.

Comments are closed.