Select Page

Introduction

If you’ve previously built programs from their source code, or are just to start out, you might already be familiar with certain commands like make and autoconf, which are a necessity for building packages. Particularly, there’s the automake command which is responsible for creating Makefiles which defines the make variables used for building the package. 

The automake command contains many predefined macros which can be used while building programs. The only way to access and use these macros is through files that are named aclocal.m4. These peculiar files are created by the aclocal command, and many package-building procedures require the command to be run. But unfortunately, many users have reported to see the following error message in their terminal screen when trying to execute the aclocal command:

$ zsh: command not found: aclocal

The aim of this article is to help you get rid of this error message, and help you properly run the aclocal command to build your packages in peace.


Why is the aclocal command not found?

The reason for encountering this error message is because you don’t have the required package installed for the command to run. If you had wondered that the command has a package of its own and had tried to install it using the name aclocal, you’d be unable to install it as there is no such package in Linux repositories with that name. Instead, you need to install the automake package, which brings along the aclocal command. In many cases, installing the package only might not get your jobs done, and you might as well need to look out for the PATH variable of your system.

All of these fixes are discussed thoroughly in the sections that follow.


Install automake for aclocal

The easiest way to install the automake package is to use a package manager. Now the problem is, the package manager differs based on the Linux Distribution you are using. The commands required to install the package in the most commonly used Linux distributions are listed below:

Arch Linux

$ sudo pacman -Syu
$ sudo pacman -S automake

Ubuntu

$ sudo apt-get update
$ sudo apt-get install automake

Debian

$ sudo apt-get update
$ sudo apt-get install automake

Fedora

$ sudo yum makecache
$ sudo yum install automake

RedHat

$ sudo dnf makecache
$ sudo dnf install automake

CentOS

$ sudo dnf makecache
$ sudo dnf install automake

The first line of command is quite important as it is used to update the repositories, while the second line of command installs the automake package. There are a few other dependencies for the aclocal command, which should already be installed on your system. If it isn’t, the package manager should supposedly install it along with automake.


Install automake from source code for aclocal

Things don’t always go right as they are supposed to, do they? In case you’re unable to install the automake package using a package manager, I have good news for you! You can directly compile the application from its source code, with the help of build tools. If you don’t have the build tools, you need to install them first. In Ubuntu, you can directly install the “build-essential” package using a package manager, which will contain all the dependencies for building packages. If you’re on other Linux distributions, you first need to install the following programs on your machine:

  • make
  • gcc

Once you’ve made sure that you have these packages installed, you can now proceed to building the automake command from its source code.

First up, download the latest source code archive from the following website:

https://ftp.gnu.org/gnu/automake/

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

https://ftp.gnu.org/gnu/automake/automake-1.16.tar.gz

Once downloaded, navigate to the directory where you downloaded the archive, and extract it using the tar command in your terminal:

$ tar -xf automake-1.16.tar.gz

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

$ ./configure

Once the configuration files have been created, you can now run the make command in order to build the program:

$ make

Lastly, you need to install the package system wide so that you can run both the automake command and the aclocal command from any directory you might be in:

$ sudo make install

This part is a bit tricky for many. Also, if you have good experience building packages from source code, and you defined a custom directory for the package to be installed in other than the default one, which is /usr/bin, you need to include that directory to the PATH variable of your system.


Fix your PATH Variable

If you have defined a different directory than the default one, you need to include it in the PATH variable using the export command in Linux. To do this, enter your system’s home directory and enter the file called .profile (which should be hidden) using the text editor of your choice. If it does not exist, create it:

$ touch ~/.profile

Now enter the file using a text editor. I use nano for tasks like this:

export PATH=$PATH:<path/to/installation/directory>

Make sure to replace the <path/to/install/directory> to the actual path where you installed the package. Now save and exit the file, and restart your terminal for changes to take effect. You should now hopefully be able to run the aclocal command without any further errors!