Skip to main content
How To

How to Install Emacs on Ubuntu

Emacs is awesome. Learn about various ways of installing the stable and the most recent versions of Emacs on Ubuntu.

Sagar Sharma

Nano comes preinstalled for editing files in the Ubuntu terminal.

Nano is a good editor. However, you'd find the advanced Linux users bragging about how they are so efficient by using emacs. And yes, it can boost your productivity up to a certain level for sure!

So this is the reason why I came up with multiple installation methods that also include how to install the most recent version of emacs.

Method 1: Install Emacs using Apt

Using the default package manager for the installation of packages is always convenient and emacs is available in the default repository.

So a single command will do the job:

sudo apt install emacs

To check the installed version, pair the emacs command with --version option:

emacs --version
check the installed version of emacs

As you can see, I'm running GNU Emacs version 27.1.

How to uninstall Emacs using Apt

By utilizing apt for installation, users get terminal and GUI version by default so you'll need to follow the given command for complete uninstallation:

sudo apt remove emacs emacs-gui

Yep, that's it!

Method 2: Install Emacs using Snap

You may also install Emacs using Snap as it may provide a newer version than the one by apt.

The installation will take a single simple command:

sudo snap install emacs --classic
install emacs using snap in ubuntu

As you can see, using snap, I got one point release ahead then the default package manager.

But snap also allows you to have the most recent version that I'll be discussing in the later part of this guide.

How to uninstall emacs snap?

Well, the uninstallation process is as easy as the installation. Yep, you guessed it right. A single command for uninstallation too.

sudo snap remove emacs

Method 3: Install Emacs using Flatpak

If you're someone who prefers flatpak over snaps like me, emacs is available as flatpak and can easily be installed.

But in Ubuntu, it does not come pre-configured and has to be done manually. We have a detailed guide on how to configure and use flatpak so you can get more out of it!

And here are some quick commands to set it up pretty quickly:

sudo apt install flatpak

Now, add the flathub repository:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Restart your Ubuntu system and you're done with the configuration part.

Now, follow the given command to install emacs using flatpak:

flatpak install flathub org.gnu.emacs

To list the installed software by flatpak, use list with flatpak:

flatpak list
list installed software using flatpak

How to uninstall?

The uninstallation process is quite straightforward and can be done utilizing the given command:

flatpak remove org.gnu.emacs
Learn Linux Quickly - Linux Commands for Beginners
Learn Linux Quickly doesn’t assume any prior Linux knowledge, which makes it a perfect fit for beginners. Nevertheless, intermediate and advanced Linux users will still find this book very useful as it goes through a wide range of topics. Learn Linux Quickly will teach you the following topics:Insta…

How to Install the most recent version of Emacs

There are two ways of getting the most recent version of emacs in Ubuntu and I'll start with the easiest one.

1. Use Snap to get the most recent version of Emacs

As I mentioned earlier, you can use snap to get the most recent version of emacs and it just requires a single command:

sudo snap install emacs --edge --classic

If you're curious, the edge branch in snaps allows us to have the most recent software by the developer. So let's check the version:

emacs -version
emacs snap pack running the most recent version in ubuntu

Running GNU Emacs version 29.0.50 which is one iteration ahead of what you generally get with default methods.

How to uninstall?

The command will be the same that I used earlier to remove the normal version of snap:

sudo snap remove emacs

2. Use PPA to get the most recent version of Emacs in Ubuntu

If you insist on using packages that can be handled through the default package manager of Ubuntu, well you can use this method to have the most recent version.

And if you're curious to learn more about PPA, I'll recommend you to check out the other guide covering every aspect of PPA:

PPA in Ubuntu Linux [Definitive Guide]
An in-depth article that covers almost all the questions around using PPA in Ubuntu and other Linux distributions.

So let's start with adding PPA to our system by the given command:

sudo apt-add-repository ppa:ubuntu-elisp/ppa

To take effect of added PPA, update repositories:

sudo apt update

And now you can use the given command to proceed with the installation:

sudo apt-get install emacs-snapshot

Once you're done with the installation, let's check for the version:

use ppa to install the most recent version of emacs in ubuntu

So I'm running the same version that I got earlier with using edge branch over snaps, GNU Emacs 29.0.50.

How to uninstall Emacs with PPA?

It is advised to remove PPA before removing the actual package so let's start with the removal of PPA:

sudo add-apt-repository --remove ppa:ubuntu-elisp/ppa

Once the repository is removed, use the given command to uninstall emacs:

sudo apt remove emacs-snapshot

And that's it.

Final Words

You saw various methods of installing Emacs on Ubuntu. If you are new to Emacs, here's a good resource to get started with it.

Basic Emacs Command Explained in Detail
Struggling with Emacs? This detailed guide gives you enough information about Emacs commands so that you can start using Emacs editor smoothly.

Through this guide, I've tried to cover various possibilities of how you can install and uninstall Emacs in a simple manner but still if you're having issues, leave a comment and I'll try to come up with a solution.

Sagar Sharma