How to upgrade gnu make in OS X El Capitan

Currently I am at:

mhoggan-C02S81PRG8WM:c_velodyne mhoggan$ make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc. This is free
software; see the source for copying conditions. There is NO warranty;
not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
mhoggan-C02S81PRG8WM:c_velodyne mhoggan$ make --version GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc. This is free
software; see the source for copying conditions. There is NO warranty;
not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0

Is there a way with Homebrew to upgrade to 4.1 or 4.2?


Solution 1:

Yes, you can run:

brew install homebrew/core/make

on earlier systems this was:

brew install homebrew/dupes/make

This will install make 4.2.1.

Another option, if you want to retain the system installed make version, is to install remake instead.

brew install remake

Solution 2:

By default homebrew installs GNU make binary with "g" prefix, as: /usr/local/bin/gmake

If you want to install it as make run:

brew install --with-default-names make

Then it will "cover" system's default make assuming /usr/local/bin preceeds /usr/bin (where the system's make resides) in your $PATH.

Solution 3:

As Michał Szajbe points out, this will install with a g prefix.

The more up to date solution (to make gmake the default make) is to modify your PATH:

Edit your .bashrc or .zshrc etc

...
export PATH="/usr/local/opt/make/libexec/gnubin:$PATH"

Running make --version should now reflect the brew installed version.