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-devClone the source repo
If you only want version 30:
git clone --depth 1 --branch emacs-30 git://git.savannah.gnu.org/emacs.git
cd ./emacsIf 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-30Configure
Run autogen:
./autogen.shRun ./configure:
CFLAGS="-march=native -pipe" \
./configure \
--prefix=/opt/emacs30 \
--with-cairo --with-libsystemd --with-modules \
--with-tree-sitter \
--with-x-toolkit=gtk3- Set
--prefixto the desired install location - If you don't want X support, remove the
--with-x-toolkitoption, add--without-x --without-sound - See
./configure --helpfor 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
-joption to the number of parallel threads you wantmaketo use
Install
sudo make installRun
/opt/emacs30/bin/emacs
/opt/emacs30/bin/emacsclientAdd to path:
PATH="/opt/emacs30/bin:${PATH}"