Here is what I did, and it works on my MacOS:
Step1: Install homebrew (installation command comes from https://brew.sh/):
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Step2: Use homebrew to install make
brew install make --with-default-names
just incase it doesn't work, try this:
brew install homebrew/dupes/make --with-default-names
Step3: You need to change the default command to use correct make instead of the default one from your MacBook or Mac.
For example, if you type
make --version
You will see:
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
Which is the default path for default version.
So, now, in your .bash_profile (which should be under your home dir /Users/your_name), add the following line:
export PATH="/usr/local/bin:$PATH"
Note: If you see the following message when you installed make:
GNU "make" has been installed as "gmake". If you need to use it as "make", you can add a "gnubin" directory to your PATH from
your bashrc like:
PATH="/usr/local/opt/make/libexec/gnubin:$PATH"
then instead run,
export PATH="/usr/local/opt/make/libexec/gnubin:$PATH"
Then source your .bash_profile. Now try to check your version:
make --version
It should show:
GNU Make 4.2.1
Built for x86_64-apple-darwin16.5.0
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Cheers.