Compiling Emacs 30.1 from the source on Debian

Cover Image for Compiling Emacs 30.1 from the source on Debian
Rahul M. Juliato
Rahul M. Juliato
#debian#emacs# source

This guide walks you through compiling Emacs 30.1 on Debian 12, covering the download, checksum verification (SHA1, SHA256), and build process. With Debian’s package dependencies, you can quickly compile, install, and uninstall Emacs with ease.

Emacs 30.1 introduces security fixes, performance improvements, and new features. If you prefer to build it from source, this guide walks you through the process step by step.

Compiling Emacs 30.1 from the source

Today, Emacs community received a really nice message from Stefan Kangas which currently is a maintainer of GNU Emacs.

You can read it here: https://lists.gnu.org/archive/html/emacs-devel/2025-02/msg00997.html.

This gives us the opportunity of building Emacs from the source (which I usually prefer, since I like to toggle some switches).

The next steps in this short tutorial will take in consideration you have the latest Debian release, in my case, running uname -a returns:

Linux debian 6.1.0-31-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.128-1 (2025-02-07) x86_64 GNU/Linux

Downloading Emacs Source-Code

Create a new directory of your liking and cd into it:

mkdir ~/emacs_build
cd emacs_build

Download the Emacs source code file. You can do this from https://ftp.gnu.org/gnu/emacs/, by accessing it from your web-browser, or:

wget -c  https://ftpmirror.gnu.org/emacs/emacs-30.1.tar.gz

Verifying the tarball checksum

Now verify the tarball (.tar.gz compressed file) checksum by running:

sha1sum emacs-30.1.tar.gz

or

sha256sum emacs-30.1.tar.gz

The returned sums should match those provided on the original release note. In my case:

57c382f8cd2bd58b146b4b120ab8941f261b82b7  emacs-30.1.tar.gz
54404782ea5de37e8fcc4391fa9d4a41359a4ba9689b541f6bc97dd1ac283f6c  emacs-30.1.tar.gz

If something is strange, stop here, check the sources and make sure you have an authentic copy of Emacs source code.

Unpacking the tarball

You can now unpack the tarball by running:

tar xvfz emacs-30.1.tar.gz

After that enter the created folder with:

cd emacs-30.1

Configuring for the build

Usually, building something from source means going trough config and make, several times, resolving dependencies and so on.

Here we're gonna cheat a little bit. Since Debian already ships some sort (normally older) of Emacs. We can ask to install the build dependencies for Emacs and save us some configure-make loop time.

Do this with:

sudo apt-get build-dep emacs

After this, it is time to configure things.

You can check all Emacs flags by running ./configure --help.

I usually go with these options:

./configure --with-native-compilation=aot\
            --with-tree-sitter\
            --with-gif\
            --with-png\
            --with-jpeg\
            --with-rsvg\
            --with-tiff\
            --with-imagemagick\
            --with-pgtk\
            --with-mailutils

Customize it to your will.

Making and Installing

In this step we're actually building the software and installing.

Start by cleaning any older building with:

make clean

If you had some problem during a previous make, or had to stop it for some reason, this will ensure you new "build" is clean and starting from the beginning.

Now we actually run make with:

make -j8

This will compile Emacs by allowing 8 jobs at once. You can leave make with only -j flag for infinite jobs or customize at will with a number.

If everything runs ok and make exits successfully you can test Emacs with ./src/emacs, I recommend just doing a version check with:

./src/emacs --version

That may return:

GNU Emacs 30.1
Copyright (C) 2025 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.

To have your built Emacs readily available, install it to your system with:

make install

Verify if you have the compiled version to your path by issuing:

emacs --version

You may have again:

GNU Emacs 30.1
...

And that's it!

Uninstalling Emacs

If things go wrong or you need to uninstall a version of Emacs before compiling a new one, it is a "necessity practice" to keep the folder from where you built your software, so you can run: make uninstall and remove it completely from your system.

Wrapping Up

You’ve successfully compiled and installed Emacs 30.1 from source! Now, enjoy the latest Emacs features and customize it to your workflow. Happy hacking! 🚀