Compatibility list

Update: These instructions have been tested on:

  • Ubuntu 24.04, Emacs 30
  • Ubuntu 26.04, Emacs 30 (2026-07-29)
    (Note that ubuntu 26.04 ships with Emacs 30 by default, so this is only necessary if you want to modify some compile-time flags)
  • Ubuntu 26.04, Emacs 31 (2026-07-29)

To build emacs-31, update the version number in the commands below accordingly.

Install dependencies

First of all, make sure to enable deb-src in /etc/apt/sources.list.d/ubuntu.sources (Types: deb deb-src), then run apt update.

Install build dependencies:

sudo apt build-dep -y emacs
sudo apt install libtree-sitter-dev

Clone the source repo

If you only want version 30:

git clone --depth 1 --branch emacs-30 git://git.savannah.gnu.org/emacs.git
cd ./emacs

If you want the entire emacs repo (beware, it's fairly large!):

git clone git://git.savannah.gnu.org/emacs.git
cd ./emacs
git worktree add ../emacs-30 origin/emacs-30

Configure

Run autogen:

./autogen.sh

Run ./configure:

CFLAGS="-march=native -pipe" \
    ./configure \
    --prefix=/opt/emacs30 \
    --with-cairo --with-libsystemd --with-modules \
    --with-tree-sitter \
    --with-x-toolkit=gtk3
  • Set --prefix to the desired install location
  • If you don't want X support, remove the --with-x-toolkit option, add --without-x --without-sound
  • See ./configure --help for other options
<!> Warning

The -march=native flag will tell gcc to make the resulting executable compatible only with the architecture of the current CPU. Remove (or modify) it if you need to redistribute the executable.

See also -march on the Gentoo wiki.

Build

make -j$(nproc)
  • If desired, adjust the -j option to the number of parallel threads you want make to use

Install

sudo make install

Run

/opt/emacs30/bin/emacs
/opt/emacs30/bin/emacsclient

Add to path:

PATH="/opt/emacs30/bin:${PATH}"

See also