Emacs is a powerful, customizable, and extensible text editor that is popular among programmers because of its rich editing features. It includes a wide range of functions and commands for editing, navigating, and manipulating text. It also supports keyboard shortcuts, syntax highlighting, and many other features that enhance the productivity of programmers. Emacs is available for Linux, BSD, Windows, and macOS. Let’s see how to install Emacs on Ubuntu 22.04.
Installing Emacs on Ubuntu via Repository (Command Line)
Emacs is included in the official repositories of Ubuntu which you can install using the Apt package manager. Follow the below steps to install Emacs on Ubuntu:
Run the following command to update the repository index:
$ sudo apt update
Then install Emacs using this command:
$ sudo apt install emacs
You will be prompted for the confirmation. Hit y and then the Enter key to continue the installation.
After installation, you can check the installed version of Emacs using:
$ emacs --version
Installing Emacs on Ubuntu via Snap (Command Line)
You can also install Emacs on Ubuntu via its snap application. However, to install Emacs Snap, you must first install Snap on your system. Here are the steps:
If Snap is already installed on your system, you can skip this step. To install Snap on Ubuntu, run the following commands:
$ sudo apt update
$ sudo apt install snapd
Provide your password for authentication and Snap will be installed on your system.
Now install Emacs Snap using the following command:
$ sudo snap install emacs --classic
The above screenshot confirms Emacs version 28.2 has installed on our system.
Installing Emacs on Ubuntu via GUI
Those who prefer GUI over the command line can use the following method to install Emacs graphically using Software Center. Here are the steps for the installation procedure:
- Open Software Center in your system and search for Emacs using the search icon at the left corner.
- The search results will display both the command line and the GUI versions of Emacs.
- Select the desired version and click the Install button.
- Then it will ask for your password for authentication. Type your password and click Authenticate.
- It will then install Emacs on your system.
Launch Emacs Editor
After installing Emacs, you can launch it either from the applications menu or the command line by simply running the following command:
Uninstall Emacs from Ubuntu
If you no longer need to use the Emacs editor, it’s better to remove it from your system to free up some space. Use the following command to uninstall the Emacs editor from Ubuntu:
$ sudo apt remove emacs
Provide your password for authentication and then Emacs will be removed from your system.
If you have installed Emacs via Snap, use the following command to uninstall it:
S sudo snap remove emacs
Using any of these command line or graphical methods, you can easily install the Emacs editor on Ubuntu. This post also explained how to uninstall the Emacs editor from Ubuntu in case you want to remove it from your system.