Debian

How to Install Emacs Editor in Debian 10

How to Install Emacs Editor in Debian 10

Emacs is an extensively used text editing tool available for most Linux systems. It is an open-source tool known for its powerful and plenty of editing features. It is a customizable and extensible text editor which does more than just editing the text.

In an earlier post, we described the installation of Emacs on Ubuntu OS. In today’s post, we will cover the installation of Emacs on Debian OS. As with Linux, there are plenty of ways to do any task, the same is true for software installation. You can install Emacs on Debian using three different ways:

  • Installing Emacs using Apt
  • Installing Emacs using Snap Package Manager
  • Installing Emacs from Source

Note: The installation procedure demonstrated here has been tested on Debian 10 machine.

Installing Emacs Using apt

In this procedure, we will install Emacs using the apt command-line utility. As of June 2021, the available version of Emacs in the default repositories is 26.1. Let’s see how to use the apt command-line utility to install Emacs on the Debian system.

1. Run the command below to update the local repositories index with information of new & updated packages.

$ sudo apt update

Provide the sudo password.

2. Then run the command below to install Emacs:

$ sudo apt install Emacs

If it prompts you with the Y/n option, press y key to continue.

3. When the installation is finished, you can verify it using the command below:

$ emacs --version

The output below verifies that Emacs version 26.1 has been installed.

Installing Emacs via Snap

In this procedure, we will install Emacs using the Snap package manager. As of June 2021, the latest available version of the Emacs snap package is 27.2. Let’s see how to use Snap package manager to install Emacs:

1. Run the command below to update the local repositories index with information of new & updated packages.

$ sudo apt update

Provide the sudo password.

2. Run the command below to install snapd (if not already installed):

$ sudo apt install snapd

3. Then install snap core using the command below:

$ sudo snap install core

4. Now in order to install the Emacs snap package, use the command below in the Terminal:

$ sudo snap install emacs --classic

After running the above command, the installation will be started. It will take a little time and once completed, you will see a similar output as shown in the below screenshot.

5. You can also verify the installation of Emacs using the command below:

$ emacs --version

The output below verifies that Emacs version 27.2 has been installed.

Installing Emacs from Source

In this procedure, we will install Emacs from the source. This procedure involves downloading the source code from the GNU Emacs official Downloads page and then compiling it. Using this method, you can install the latest or any other available version of Emacs available on the official website. Let’s see how to install Emacs from the source:

1. First install the build-essential package. It will automatically install certain packages that we require for compiling the source code.

$ sudo apt-get install build-essential

2. Then use the below command to install the dependencies needed for building Emacs:

$ sudo apt-get build-dep emacs

3. Download the Emacs source code. Visit the below link and when the website opens, click the nearby GNU mirror. From the mirrors page, you will see a list of new and older versions of Emacs packages. Download the one (in tar.gz format) you want to install on your system.

https://www.gnu.org/software/emacs/download.html

Here, we have downloaded the emacs-27.2.tar.xz source package.

4. As the downloaded package is an archive file, we will need to extract its content. Use the command below to extract the archive.

$ sudo tar -xf emacs-27.2.tar.xz

Replace emacs-27.2.tar.xz with your archive name. After extracting the archive, use the ls command which will show you a directory with the same name as your Emacs source code package (but without tar.gz at the end of its name).

5. Use the cd command to move inside the extracted directory.

$ cd emacs-27.2/

6. Now run the command below to check your system for the dependencies required for building the source code:

$ sudo ./configure

7. Then use the command below to compile the source code:

$ sudo make

8. After the compilation is done, use the command below to install it:

$ sudo make install

Emacs should now be installed on your system.

9. To verify the installation of Emacs, use the command below:

$ emacs --version

The output below verifies that Emacs version 27.2 has been installed.

Launch Emacs

You can launch Emacs either from the command line or from the GUI.

To launch Emacs from the command line, type emacs and hit Enter:

$ emacs

To launch Emacs from the GUI, click the Activities in the upper most corner of your desktop. Then search and Launch Emacs using the search area at the top.

You will see this default window after launching Emacs.

Uninstall Emacs

For some reason if you no longer need Emacs on your system, you can uninstall it easily using the below-described methods:

1. If you have installed Emacs using apt, you can uninstall it as follows:

$ sudo apt remove emacs

2. If you have installed Emacs using snap, you can uninstall it as follows:

$ sudo snap remove emacs

3. If you have installed Emacs from the source, you can uninstall it as follows:

Move inside the Emacs extracted directory:

$ cd emacs-27.2/

Then uninstall it:

$ sudo make uninstall

In this post, we have described three different methods to install Emacs on Debian OS. Based on your preferences, you can choose among any of these methods.

Similar Posts