Skip to content

Instantly share code, notes, and snippets.

@shanbhardwaj
Last active February 5, 2026 09:38
Show Gist options
  • Select an option

  • Save shanbhardwaj/866f20e98303379ca8bfbe2f0c5b7a87 to your computer and use it in GitHub Desktop.

Select an option

Save shanbhardwaj/866f20e98303379ca8bfbe2f0c5b7a87 to your computer and use it in GitHub Desktop.
Build emacs on ubuntu
# Setting up Emacs in our source directory
mkdir -p ~/src && cd ~/src
git clone --depth 1 --branch emacs-30 git://git.savannah.gnu.org/emacs.git
git checkout emacs-30
# Enable development libraries and update apt cache
# for Ubuntu >= 24.04
sudo sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources && apt update
# for ubuntu < 24, uncomment and use the following
# sudo sed -i 's/# deb-src/deb-src/' /etc/apt/sources.list && apt update
# Install necessary dependencies
sudo apt build-dep -y emacs \
&& sudo apt install libtree-sitter-dev
# Generate the configure file
./autogen.sh
# Configure Emacs with desired options
# --with-ctags --with-dbus --with-debug --with-mailutils --with-x11 --with-xwidgets
./configure --with-imagemagick
# Compile with 4 cores
make -j4 bootstrap
# Verify the version
./src/emacs --version
# Optionally, test things by launching Emacs without any configuration
./src/emacs -Q
# When things look good, install Emacs system-wide
sudo make install
@shanbhardwaj
Copy link
Author

shanbhardwaj commented May 15, 2025

👍🏼

updated!

@NDari
Copy link

NDari commented May 23, 2025

For 24.04 the source list has been moved. This will do the trick:

sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources

Though I ran into some other issues and had to drop a few of your config flags.

@shanbhardwaj
Copy link
Author

👍🏼updated for ubuntu 24.04+

@vitorquintanilha-prima
Copy link

I'm pretty sure the --with-json is no longer used on emacs30: https://www.gnu.org/software/emacs/manual/html_node/efaq/New-in-Emacs-30.html

@shanbhardwaj
Copy link
Author

👍🏼updated

@jbulow
Copy link

jbulow commented Sep 2, 2025

The clone should be:

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

--branch requires a branch...

@shanbhardwaj
Copy link
Author

👍🏼updated

@nicolasshu
Copy link

In case you're trying to run ./configure --with-imagemagick on a fresh Debian system, you may need to install the package libmagickwand-dev first

@fleutot
Copy link

fleutot commented Feb 5, 2026

apt update needs sudo as well.

@fleutot
Copy link

fleutot commented Feb 5, 2026

Missing cd emacs after cloning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment