How to Install GNU Emacs 28.1 in Ubuntu 22.04 | 20.04

This simple tutorial shows how to install the GNU Emacs text editor 28.1 and keep up-to-date in Ubuntu 22.04, Ubuntu 20.04, and Ubuntu 18.04

GNU Emacs text editor has reached v28 release series for few months, though Ubuntu still has v27.1 in its universe repository. For those would like to install/upgrade the editor, here are 3 different ways to do the trick in Ubuntu and its based systems.

Method 1: Snap Package

Snap is an universal Linux package format that runs in sandbox. It works on most Linux, and updates automatically when a new release is published. GNU Emacs is available as Snap with support for amd64 modern PC/laptop, arm64/armhf, ppc64el and s390x processors.

Ubuntu user can simply search for and install the package from Ubuntu Software. There are multiple app packages in software center, select install the one from “Snap Store”.

Install Emacs from Ubuntu Software

For other Linux, it’s available to install via https://snapcraft.io/emacs

Method 2: Ubuntu PPA

For those do NOT like applications run in sandbox, there’s an Ubuntu PPA contains the native .deb package for Ubuntu 22.04, Ubuntu 20.04, and Ubuntu 18.04.

Like the Snap and Flatpak packages, it’s a third-party repository. Though the maintainer has been working on the PPA for more than 5 years. Also, it supports for amd64, arm64/armhf, and ppc64el CPU architecture types.

1. Firstly, press Ctrl+Alt+T on keyboard to open terminal. Run command to remove the old emacs package if any, since it conflicts to the package from PPA.

sudo apt remove --autoremove emacs emacs-common

2. Then, run the command below to add the PPA:

sudo add-apt-repository ppa:kelleyk/emacs

Type user password when it asks and hit Enter to continue

3. Then run the command to update system package cache, which should be done automatically in Ubuntu 20.04 and higher during adding PPA.

sudo apt update

4. Finally, install Emacs 28 via command:

sudo apt install emacs28

Here you may replace emacs28 with emacs28-nox for text-only interface and/or emacs28-nativecomp with native compilation enabled.

Method 3: Emacs Flatpak

The text editor is also available as the universal Flatpak package which runs in sandbox. Like Snap, the package runs in most Linux and it’s easy to update. However, it takes more disk space due to run-time libraries.

1. First, press Ctrl+Alt+T on keyboard to open terminal. When it opens, run command to install the flatpak daemon:

sudo apt install flatpak

2. Then, install Emacs as Flatpak via command:

flatpak install https://dl.flathub.org/repo/appstream/org.gnu.emacs.flatpakref

How to Remove Emacs text editor

The Emacs Snap, Flatpak and Deb packages can be installed all together in your system. So, there may be duplicated app icons when you try to launch the editor.

To remove the Snap package, either use Ubuntu Software or run command in terminal:

sudo snap remove emacs

To remove the Flatpak package, use command:

flatpak uninstall --delete-data org.gnu.emacs

And clear useless runtime via flatpak uninstall --unused.

To remove the Deb package, run command:

sudo apt remove --autoremove emacs28 emacs28-common

And remove the Ubuntu PPA via command:

sudo add-apt-repository --remove ppa:kelleyk/emacs

By Ji m

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to remind me outdated tutorial! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via ubuntuhandbook1@gmail.com Buy me a coffee: https://ko-fi.com/ubuntuhandbook1

2 comments

  1. Hello. Thanks for this work, it’s very helpful. Unfortunately on Ubuntu emacs28 collides with the following error:
    npacking emacs28 (28.1~1.git5a223c7f2e-kk3+20.04) …
    dpkg: error processing archive /var/cache/apt/archives/emacs28_28.1~1.git5a223c7f2e-kk3+20.04_amd64.deb (–unpack):
    trying to overwrite ‘/usr/include/emacs-module.h’, which is also in package emacs-common 1:26.3+1-1ubuntu2
    dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
    Errors were encountered while processing:

    Any idea what I should do?

    1. It seems the old emacs-common package prevent from installing the new package.

      Try remove the package first via command:

      sudo apt remove emacs-command

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Exit mobile version