macOS make执行Makefile解决unable to find utility “make”, not a developer tool or in PATH
2023-01-11
macOS系统中make编译执行文件Makefile,遇到报错:
sh: line 1: 6272 Abort trap: 6 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk '' -find make 2> /dev/null
make: error: unable to find utility "make", not a developer tool or in PATH
提示明显,缺少make工具,查阅相关资料后,问题多是与Xcode有关,笔者macOS当前系统是10.14.2,已经很过时了,而且Xcode也很久没用过,需要升级。
对于开发者来说,升级macOS系统风险还是挺高的,每次基本上会重新折腾一番开发环境,痛苦~
为避免升级,最后勉强找到了解决方法:
- 安装 Command Line Tools
$ xcode-select --install
2.修改xcode-select指向的位置的命令,并查看最新命令行工具路径
$ sudo xcode-select --switch /Library/Developer/CommandLineTools
$ xcode-select --print-path
新路径打印出来:/Library/Developer/CommandLineTools,就可以愉快用make了。
参考资料
- https://blog.51cto.com/u_15060533/4200476
- https://www.jianshu.com/p/371586711d09
- https://stackoverflow.com/questions/23836149/xcode-5-1-unable-to-find-utility-make-not-a-developer-tool-or-in-path