How to Install Emacs on Ubuntu 22.04

Emacs is the text editor and the popular IDE (Integrated Development Environment) to write, compile, debug, and execute the code of different programming languages. Emacs is available for multiple Linux-based distributions.

This blog explores different installation methods of Emacs on the latest release of Ubuntu 22.04. The prominent outcomes are listed below:

Let’s start with the first method:

Method 1: Using Default Repository to Install Emacs on Ubuntu 22.04

The package of “Emacs” comes in the default repository of Ubuntu 22.04. Follow the below-stated steps to get “Emacs”:

Step 1: Update System Packages

While installing any package from the Ubuntu default repository, it is recommended to update the core libraries of Ubuntu to get the latest version available:

$ sudo apt update

Step 2: Install Emacs

Once the repository is updated, install “Emacs” via the command:

$ sudo apt install emacs -y

The package has been installed on Ubuntu.

Step 3: Verify the Installation

To display the installed version of “Emacs” on Ubuntu 22.04, use the command:

$ emacs --version

The version “27.1” of emacs has been installed on Ubuntu.

Furtherly, the user can run the application from Ubuntu’s terminal as follows:

$ emacs

The GUI of “Emacs” has been launched:

How to Uninstall Emacs on Ubuntu 22.04?

To uninstall the installed package of “Emacs”, use the purge option of the apt package manager:

$ sudo apt purge emacs -y

The successful execution represents that the “Emacs” has been removed successfully.

Method 2: Using Flathub to Install Emacs on Ubuntu 22.04

Another approach to install emacs on Ubuntu 22.04 is by downloading its package from the flathub using the flatpak utility. To download and install the emacs on Ubuntu from flathub, run the command:

$ flatpak install flathub org.gnu.emacs

A message of “Installation complete” is displayed upon the successful installation of the “Emacs”.

How to Remove Emacs on Ubuntu 22.04?

If the “Emacs” is installed on the system via Flatpak and the user wants to remove it, then the following command will serve the purpose:

$ flatpak uninstall flathub org.gnu.emacs

The “Uninstall complete” message validates the successful execution of the above command.

Method 3: Using Snap to Install Emacs on Ubuntu 22.04

Emacs editor can also be installed using the snap store. Users can download and install the snap of emacs from the Snapcraft store using the command:

$ sudo snap install emacs --classic

It can be seen that the “Emacs 28.1” is installed via the snap.

How to Remove Emacs on Ubuntu 22.04?

The users can also use the snapcraft utility to remove any package installed from the snap store. In such a case, the “Emacs” can be removed via the command:

$ sudo snap remove emacs

Emacs package from Ubuntu.

That’s all from this detailed installation guide of Emacs on Ubuntu 22.04.

Conclusion

Emacs can be installed from the official repository, snapcraft, or the flathub. Use the “sudo apt install emacs -y” to install Emacs from the official repository. To install using snapcraft or flathub, use the “sudo snap install emacs –classic” or “flatpak install flathub org.gnu.emacs” commands respectively. This write-up has demonstrated multiple installation methods of Emacs on Ubuntu 22.04.