Skip to main content

How to build emacs from source

·109 words·1 min
  1. Clone emacs repo
    git clone https://git.savannah.gnu.org/git/emacs.git
    cd emacs
  2. Checkout latest
    git tag # find the latest
    git checkout LATEST_TAG
  3. Install Build dependencies
    sudo apt update
    sudo apt install build-essential autoconf texinfo \
         libgtk-3-dev libxpm-dev libjpeg-dev libgif-dev libtiff-dev \
         libgnutls28-dev libncurses-dev libjansson-dev \
         libtree-sitter-dev libgccjit-13-dev
    libgccjit should be the same version to your gcc version.
  4. Generate Build system
    ./autogen.sh
  5. Configure
    ./configure --with-native-compilation --with-tree-sitter --with-x-toolkit=gtk3
  6. Build
    make -j$(nproc)
  7. Install
    sudo make install
  8. Create a desktop launcher
    1. Create the desktop file
      mkdir -p ~/.local/share/applications
      vim ~/.local/share/applications/emacs.desktop
    2. Paste this:
      [Desktop Entry]
      Name=Emacs (Source Build)
      GenericName=Text Editor
      Comment=GNU Emacs built from source
      Exec=/usr/local/bin/emacs %F
      Icon=emacs
      Terminal=false
      Type=Application
      Categories=Development;TextEditor;
      StartupWMClass=Emacs
    3. Finally, run this
      update-desktop-database ~/.local/share/applications