How to Install GNU Emacs (29.3 Updated) in Ubuntu 22.04 | 20.04

Last updated: March 26, 2024 — 6 Comments

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

GNU Emacs text editor has reached v29.x 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 24.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:ubuntuhandbook1/emacs

Type user password (no asterisk feedback) 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 via command:

sudo apt install emacs emacs-common

Here you may replace emacs with emacs-nox for text-only interface.

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 emacs emac-common

And remove the Ubuntu PPA via command:

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

Twitter

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 let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee: https://ko-fi.com/ubuntuhandbook1

6 responses to How to Install GNU Emacs (29.3 Updated) in Ubuntu 22.04 | 20.04

  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?

    • 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
  2. thank you. it works.

  3. Eugene Mikhaylov November 27, 2022 at 7:52 am

    Thank you!

  4. Thanks a lot.
    It works for me..

  5. Thanks much for introducing me to `emacs28-nativecomp`!

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

*