Select Page


Whether or not you’re a very techy person, The thing about “Vim vs Emacs” is probably something you’re not unheard of. If you’ve been a long time Emacs user, or are simply willing to give this thing a try, but your terminal returns you with the following error message:

“emacs: command not found”

there’s no doubt you’re already getting quite a bad impression of it. But luckily, it’s not the fault of Emacs, but the operating system itself. However, if it is not yet installed in your machine and you’re expecting it to run right out of the box, it’s probably more of your own fault. 

Anyways. Whatever the case might be, here are all the different ways you could try out to fix the error message, and get Emacs up and running in your terminal emulator.

Install emacs in Linux

Pretty much all the time, the most obvious solution to fixing this error for emacs is to install Emacs in your system. Yes, you’ve heard it right. Whether you’re inside Windows Subsystem for Linux (WSL), in MacOS, or any generic Linux distribution, installing the package is the main solution to the error message.

However, it is possible that you’ve already installed Emacs, but you’re still unable to execute it. This might be because of some issues related to the PATH variable, which we will be discussing later on in the article.

Emacs has two different versions, one with a Graphical User Interfaces, and the other one being text-based only that runs inside a terminal. It’s safe for us to assume that you’re trying to run the Terminal version of Emacs, as otherwise you’d probably have not seen the error message.

For now, in order to install Emacs in a Linux Machine, what you’d want to do is use a package manager. Package managers differ based on the distribution of Linux you’re using, so you’d have to use the one that ships with your system. Here are the commands used to install Emacs in the most commonly used Linux Distributions:

Arch Linux

$ sudo pacman -Syu
$ sudo pacman -S emacs


$ sudo apt-get update
$ sudo apt-get install emacs


$ sudo apt-get update
$ sudo apt-get install emacs


$ sudo yum makecache
$ sudo yum install emacs


$ sudo dnf makecache
$ sudo dnf install emacs


$ sudo dnf makecache
$ sudo dnf install emacs

The first line of command will update your system repositories, which is quite crucial. The second line of command will install the emacs package on your Linux machine. 

Afterwards, you should no longer be seeing the error message. If you still do, you might want to make sure that your PATH variable is set right. If you are looking forward to installing Emacs on your MacOS machine instead, check out the next section.

Install Emacs in MacOS

Starting from MacOS Catalina, Emacs is no longer provided with the system, which is why you need to install the package. The easiest way to do it is to use a package manager, called Homebrew. Install it first if you haven’t already, by visiting their website, and once you’ve installed it properly, run the following command in your MacOS terminal to install emacs:

$ brew install emacs

In case you’re unable to use the package manager, you can also build the program from its source code, given that you have the build tools installed and have a moderate understanding of building packages.

Install Emacs from Source Code

In both Linux and MacOS, you can use the source code of Emacs to build and install the program on your system. But before you can, you need to make sure that you 

At first, visit the following link to download the latest archive of Emacs:

Or you can click on the following link to directly download the latest version of Emacs, as of now, which is v28.2:

Once downloaded, navigate to the directory where the file got downloaded, and use the tar command in your terminal to extract the archive:

$ tar -xf emacs-28.2.tar.gz

Now enter the directory that got extracted, and run the configure script using:

$ ./configure

Once the configuration files have been created, run the make command to build the package:

$ make

Lastly, install the program systemwide by running:

$ sudo make install

You should now hopefully be able to run emacs with no further error in your machine. If your Linux machine is still struggling to run emacs, there’s one last thing you should do before you think to move on!

Fix the PATH Variable

In any operating system, the PATH variable is a very essential one. It lists all the root directories for applications, so that your system can trace for a given application when you’re trying to execute it. If somehow, the directory of your application is not listed in your system’s PATH variable, then you’d not be able to run that program.

In Linux, there is a directory called /usr/bin where most of the user-installed packages are located, including Emacs. If your PATH variable does not list this directory, then Emacs will not be executable either. So to fix this, first enter the file called .bashrc in your home directory (if you’re using the Bourne Again Shell) or the file called .zshrc (if you’re using the ZSH Shell), and append the following line:

export PATH=$PATH:/usr/bin/

Afterwards, restart your terminal for changes to take effect, and check whether you’re able to run Emacs. If you can, Congratulations!

But if you still haven’t been able to do so, it’s time for you to consider a few alternatives (as long as you’re not a die-hard user of Emacs).

Alternatives to Emacs

I respect both VIm fans and Emacs fans, for their dedication to their text editors. However, at times when you have no other choice, you might want to consider an alternative piece of program. Some of the best Emacs alternatives are probably the ones below:

  • Neovim
  • Vim
  • Helix
  • Micro
  • Kakuone
  • Ne
  • Nano