这是我所做的,它适用于我的 MacOS:
Step1:安装homebrew(安装命令来自https://brew.sh/):
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Step2:使用自制软件安装make
brew install make --with-default-names
万一它不起作用,试试这个:
brew install homebrew/dupes/make --with-default-names
第 3 步:您需要更改默认命令以使用正确的 make 而不是 MacBook 或 Mac 中的默认命令。
例如,如果您键入
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
默认版本的默认路径是什么。
所以,现在,在您的 .bash_profile(应该在您的主目录 /Users/your_name 下)中,添加以下行:
export PATH="/usr/local/bin:$PATH"
注意:如果您在安装 make 时看到以下消息:
GNU“make”已安装为“gmake”。如果您需要将其用作“make”,您可以将“gnubin”目录添加到您的 PATH 中
你的 bashrc 喜欢:
PATH="/usr/local/opt/make/libexec/gnubin:$PATH"
然后运行,
export PATH="/usr/local/opt/make/libexec/gnubin:$PATH"
然后获取您的 .bash_profile。现在尝试检查您的版本:
make --version
它应该显示:
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.
干杯。