Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
825 views
in Technique[技术] by (71.8m points)

macos - Updating Make Version on Mac

I'm trying to update the version of make on my mac but am running into issues. The minimum project dependency is 4.1 but my version seems to be 3.81. I've updated Xcode to the latest version and installed the command line tools but it still seems to be the older version.

Has anyone run into this issue or know of a way to resolve it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...