If you put the path where make install installs before the path where the old make is found it will use the newer make.
If the old one lives in /opt/xcode/bin and make install installs to /usr/local/bin, then make sure /usr/local/bin comes before /opt/xcode/bin in your PATH variable.
Answer from Puppe on Stack OverflowPATH=/usr/local/bin:/opt/xcode/bin
macos - Upgrade gnu make on mac - Stack Overflow
Need help to install GNU make - Apple Community
makefile - How to install 'make' and GCC on a Mac - Stack Overflow
gmake on Mac
Videos
Update for newer versions:
The command line versions can now be installed straight from the command line itself;
- Open "Terminal" (it is located in Applications/Utilities)
- In the terminal window, run the command
xcode-select --install - In the windows that pops up, click
Install, and agree to the Terms of Service.
Once the installation is complete, the command line utilities should be set up property.
Older versions:
Installing recent Xcode versions confusingly enough does not automatically install the command line tools. To install the command line tools when they're not automatically installed;
- Start Xcode.
- Go to Xcode/Preferences.
- Click the "Downloads" tab.
- Click "Components".
- Click "Install" on the command line tools line.
That will install the command line tools and make them accessible from a regular command line.
With Homebrew installed on my Mac, the installation was as simple as running the command
brew install make
It might require root permissions.
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
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.