Emacs download and installation on Ubuntu

Over the last couple of years, lots of development has been seen in the industry, leading to the emergence of a large set of tools that have proved to be highly beneficial and useful. One set of tools is the text editor, who has significantly grown in prominence amongst programmers. Text editors are simple, lightweight tools that allow users to create and edit their files.

Their flexible nature, as well as out of the box performance, has led to their increasing popularity. Since they are considered the backbone of a developer, it is thus imperative to choose the one which offers the best features while allowing work to be done efficiently.

Emacs is one such text editor that offers some of the best features to its users. It is an open-source, cross-platform editor that is highly customizable and provides a user-friendly interface to its users. Providing features like multiple editing modes, full Unicode support for scripts, text manipulation tools, and integration with numerous external tools like the shell and git clearly gives an indication of how powerful it is.

In addition to this, it not only acts as a text editor but can also be set up to provide other functionalities such as project planner, debugger, email client, etc. Hence, in this article, we will be looking at how you can download and install Emacs on your Ubuntu system.

Installing Emacs in Ubuntu

Ubuntu offers multiple ways for users to install Emacs on their computers. Let us look at some of them:

Installing Emacs using Snap

Snaps are Canonical developed applications that can be installed on almost all Linux distributions. A considerable advantage of using Snaps over using Ubuntu repositories is that it provides users with the most up-to-date software without sacrificing the reliability of your working environment. Installing applications through Snap is extremely easy. Users can install Emacs by running the following command in the command line:

$ sudo snap install emacs --classic

Once this is done, you can find Emacs in your list of installed applications.

Installing Emacs using the PPA Repository

Some users, however, have found the snap versions of Emacs to be less stable and buggier. Thus, a better alternative for installing Emacs is by using the PPA repository.

To do this, open the terminal via Ctrl+Alt+T or by searching terminal in the Ubuntu Dash. Once the Terminal is opened, enter the following command:

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

It is a stable PPA repository maintained by Kevin Kelley that contains the support for the latest Emacs packages. It also has support for the packages: mailutils, systemd, and xwidgets, which are dependencies required by Emacs.

After entering the command, you will be asked to enter your password (as shown in the image below). Do so, and it will then add the PPA repository to your system.

Next, we want to update our system’s apt-cache and packages to the latest versions so that no issues arise during installation. This can be done by running the following command into the terminal:

$ sudo apt-get update

Finally, Emacs can be installed by running the following command:

$ sudo apt install emacsVERSION

Over here, the Version refers to the version number of Emacs that you want to install. In my case, it would be 26.

$ sudo apt install emacs26

Users can also check the version of their installed Emacs by entering the following command into the terminal:

$ emacs --version

Build and Compiling Emacs

Another painless way of installing Emacs is by building and compiling ourselves. To do this, we need to install some dependencies first. For installing the build dependency, enter the following command into the terminal:

$ sudo apt-get install build-essential

Next, for downloading the Emacs dependencies, we first have to enable the Source Code download option. To do this, go to Software & Updates and activate Source Code found under the Ubuntu Software heading.

Now enter the following command to download the Emacs dependencies:

$ sudo apt-get build-dep emacs26

After installing the dependencies, we now have to download the source distribution of Emacs. To do this, go to the website of Emacs and click on GNU/Linux.

Now click on the hyperlink with the name nearby GNU mirror provided under the GNU/Linux heading.

You will then be directed to a website where all the releases of Emacs will be present. Choose and download the one which you want to install in your system. In my case, I will be downloading the emacs-26.3 tar.gz file.

When the tar file has been downloaded, go to the folder where it was downloaded and extract it using the command:

$ tar -zxvf emacs-VERSION.tar.gz

Over here, the Version refers to the version number of Emacs that you downloaded. In my case, it would be 26.3 (See the image below for better understanding)

If you’re not interested in seeing the files being extracted, you can instead enter the command:

$ tar -zxf emacs-VERSION.tar.gz

Now enter the directory of your installed Emacs (emacs-VERSION would be the directory name) and compile Emacs by running the following commands into the terminal:

$ cd emacs-Version
$ ./configure
$ make

In my case, this would be:

$ cd emacs-26.3
$ ./configure
$ make

Finally, Emacs can be installed by running the command:

$ make install

Why use Emacs?

Emacs is one of the most powerful text editors out there, known for its dynamicity and customizable nature. It is highly flexible and extensible, as users can easily customize and set it up according to their preferences. In addition to this, it offers some extremely useful editing tools that make the work of developers much easier and faster. Emacs is undoubtedly a must editor to have.

About the author

Zeeman Memon

Hi there! I'm a Software Engineer who loves to write about tech. You can reach out to me on LinkedIn.