×


Install Emacs Editor in Debian 10 - Best Method ?

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.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Linux System Software Installation queries.

In this context, we shall look into how to install Emacs on Debian OS. 

Previously, we dealt with the Installation of Emacs on Ubuntu OS.


Different methods of Installing Emacs on Debian ?

You can install Emacs on Debian using three different ways:

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


1. Emacs Installation via Apt

Here, 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.

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

$ sudo apt update

Provide the sudo password.

ii. 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.

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

$ emacs --version

The output verifies that Emacs version 26.1 has been installed.


2. Emacs Installation via Snap

Here, 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:

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

$ sudo apt update

Provide the sudo password.

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

$ sudo apt install snapd

iii. Then install snap core using the command below:

$ sudo snap install core

iv. 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 to get completed.

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

$ emacs --version

The output verifies that Emacs version 27.2 has been installed.


3. Emacs Installation from Source

Here, 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:

i. 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

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

$ sudo apt-get build-dep emacs

iii. 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.

iv. 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).

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

$ cd emacs-27.2/

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

$ sudo ./configure

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

$ sudo make

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

$ sudo make install

Emacs should now be installed on your system.

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

$ emacs --version

The output verifies that Emacs version 27.2 has been installed.


How to 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.


How to Uninstall Emacs from your Debian System ?

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

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


[Need help in Installing any Software on your Linux System ? We can help you. ]


Conclusion

This article covers the different methods to install Emacs on Debian OS. Emacs is a widely used open-source text editor for Linux. It exists for many years now and can be used for basic word processing, code editing, and scripting, etc.


How to Install Emacs editor on Debian ?

1. To start the installation process, login with root and update the package repository with the following command.

$ apt-get update

2. Next, run the following command on the terminal and wait for the operation to complete. This can take several minutes. When you are asked for confirmation, press Y from your keyboard.

$ apt-get install emacs