If you use FreeBSD, then you might see the following error when you’re trying to compile C code – configure: error: GNU make is required! Assuming that you’re already working on a command line interface as this error would generally only appear in such, you’d probably try to change into the /usr/ports/devel/gmake/ directory. Generally, you’ll find that you receive a “No such file or directory” error in response to your attempt. This stems from the fact that you don’t have the GNU make port installed on FreeBSD.
Fortunately, it’s easy enough to install the repository that contains this port as well as the GNU make software itself. While this is standard software on the GNU/Linux platform, it needs to be installed by the user on FreeBSD.
Method 1: Installing GNU make
In a vast majority of cases, a single command is all that’s needed to prep your system to prevent this error from happening. At the command line, run pkg install gmake and push enter. If you’re asked to approve the changes, then type y and push enter. Let the command run it’s course and install GNU make. It shouldn’t take very long, and if you received no other messages you’re all set to go.
You may receive an error about insufficient privileges. You’ll have to be logged into the prompt as root if this is the case. You can type exit and push enter to leave the existing session then type root followed by your root password to log into root before running pkg install gmake. If you installed sudo, then you can run sudo -i and then pkg install gmake to install the software.
Method 2: Installing the FreeBSD ports tree
There’s a chance you don’t have the right ports tree installed in the first place. You’ll need the pots tree installed if you want to load any ports into FreeBSD from source code written in the C programming language. From the command line, run portsnap fetch extract and push enter. Should you have already set up the portsnap system, then you can instead run portsnap fetch update to run an update. Again, you’ll probably have to be operating as root to do so. Remember to type exit and push enter when you’re done since you don’t want to be stuck at a root prompt any longer than you need to be.
Regardless, these two commands will get the tree properly configured in no time. Make sure that you’re connected to the Internet if you receive any other error messages, since the pkg tool needs to access FreeBSD’s repositories to load these packages.
Method 3: Checking the Current Version of GNU Make from FreeBSD Ports
While you’re still want to install it from the terminal, the FreeBSD Project has a ports page on the Web you can use to check the current version of GNU Make. It’s very useful before installing a new package to make sure you don’t already have the latest one.
If you’re using a desktop environment, then open your Web browser. Users of full-featured FreeBSD implementations like TrueOS can click on the GNOME, Cinnamon or MATE applications menu or shortcut menu to start Firefox or Chromium. Those using LXDE or KDE can select the Applications menu and then find a browser on the Internet tab.
Type https://www.freebsd.org/ports/ into the URL bar and push the enter key. Many FreeBSD installations are headless with nothing but a terminal, but if you have the w3m port installed you can type w3m https://www.freebsd.org/ports/ and push enter to accomplish the same. In either case, type gmake into the search box and push enter then scroll down.
You’ll find the latest version of GNU Make that FreeBSD currently supports. This will give you a clue if you thought that the version number that the portsnap fetch update command gave you seemed to be a bit unusual. Keep in mind that many FreeBSD ports of GNU tools feature different version numbers than the latest versions of said tools canonically released for GNU/Linux installations.