How to install Emacs: An easy, step-by-step guide
This article will cover what Emacs is, and how you can install it on Linux systems (Ubuntu, CentOS), OS X, and Windows.
Jun 08, 2023 • 4 Minute Read
So, you want to install Emacs? This article will cover what Emacs is, and three different ways you can install it. We will go over how to install Linux systems (Ubuntu, CentOS), OS X, and Windows. We will also cover how to build and install Emacs from the source code.
What is Emacs? (A quick summary)
Emacs is a powerful text editor designed for POSIX operating systems, and is available on Linux, BSD, macOS, Windows, and more. However, once you begin to learn about Emacs you will find that this software is very complex and that you can use it for far more than just editing text! It is an IDE for developers, you can use it to compile code, use it for email, or simply play some games with it.
How to Install Emacs
“Emacs sounds great! Now how do I install it?” Below, we share four different ways you can do that, depending on your operating system and your needs.
1. How to install Emacs on Ubuntu Linux using apt.
Installing Emacs on Ubuntu using the apt package manager is pretty straightforward, and should only take a few minutes to complete.
First you need to update your package repository. This is simply done by running the following apt command:
sudo apt update
Once the update has finished, you can now move onto the next step of installing the Emacs package. This is also done using the apt command.
sudo apt install -y emacs note: the -y is optional, without it you will need to manually reply to an install prompt.
Emacs has now been installed on your Ubuntu system!
Alternatively, you can use the snaps from the Snap Store to install the Emacs software. This is done using the snap command.
sudo snap install emacs --classic
2. How to install Emacs on CentOS 8 Linux using dnf.
Much like the first method, installing Emacs on CentOS 8 is also fairly simple. CentOS is an RPM based Linux OS, so instead of apt, we will be using dnf to install the Emacs software.
sudo dnf install -y emacs note: the -y is optional, without it you will need to manually reply to an install prompt
The following dnf command will install the software onto your system.
If you happen to be running an older version of CentOS you will probably need to use yum instead of dnf, but the syntax looks the same.
sudo yum install -y emacs note: the -y is optional, without it you will need to manually reply to an install prompt
And that is all there is to installing Emacs on your CentOS 8 system!
3. How to build and install Emacs from the source code.
You may find that you want to install the newest version of Emacs, but it hasn’t been packaged for your particular Linux distribution yet. There’s no need to wait for the packaging to happen, you can build Emacs from the source code.
The first requirement to build Emacs from the source code is to make sure that you have an environment that has all the build tools properly installed. The extra packages you need to have installed may vary depending on what OS you have running, and what packages you may already have installed. The following extra packages are what I have typically had to install to get the source code to properly build.
Apt based system
libncurses-dev libgnutls28-dev gnutls-bin pkg-config
RPM based system
gcc make gnutls gnutls-devel ncurses ncurses-devel
Once you have a working environment to build Emacs, you need to download the source code. You can find the various archives on the Emacs ftp site. Next download the source code for the version you would like to use.
wget https://ftp.gnu.org/gnu/emacs/emacs-28.1.tar.xz note: this would download the source code for version 28.1
Now you will need to extract the source code from the tar archive.
tar xvf emacs-28.1.tar.xz
After extracting the archive, it is time to build Emacs! The following commands can be used to accomplish this.
cd emacs-28.1 ./configure make make install
The build may take several minutes to complete. Upon completion you will have the version of Emacs you downloaded installed on your system ready to use.
4. How to install Emacs on other operating systems (OS X, Windows)
Emacs is also available for OS X and Windows. To install it on OSX, the quickest way is to download it from the Emacs for OSX website. Once you have the .dmg file downloaded, just open it up and follow the instructions provided.
Similar to OSX, Emacs is also packaged up with an installer for windows. You can download the installer from the Emacs FTP site. The easiest way to do this is to download the emacs-<version>-installer.exe and then run it on your system.
You have installed Emacs, now what?
Now that you have installed Emacs you are ready to get started using it. In a terminal window just enter ‘emacs’ and press enter, or launch the application via launchpad on OSX or the shortcut in Windows. You will now be in Emacs and are ready to start editing files, creating code, sending email, and even playing some built-in games like Tetris. Nice!
If you would like to learn more about editing text with Emacs, then I invite you to join me in my course Text Editing with Emacs. I hope to see you there. Until next time, keep being awesome Gurus!