xcode运行脚本wget: command not found
因为xcode的环境变量较本地不同,需要将wget放入到其指定的几个目录下
本文只以wget为例 其他命令以此类推
一、运行环境
1.系统版本macOS12.1 2.xcode版本13.2.1 3.本地已安装wget
二、问题描述
1.脚本为通过配置在build的同时运行.sh脚本,出现wget:command not found 2.本地开启终端通过 sh .sh命令是可以正常执行脚本的
三、解决方案
1.打开终端通过命令获取wget安装目录
which wget
输出结果参考:
/opt/homebrew/bin/wget
2.通过xcode运行脚本
echo $PATH
输出结果参考:
/Users/lixuejian/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Users/lixuejian/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/bin:/Users/lixuejian/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec:/Users/lixuejian/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/bin:/Users/lixuejian/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/local/bin:/Users/lixuejian/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Users/lixuejian/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/local/bin:/Users/lixuejian/Downloads/Xcode.app/Contents/Developer/usr/bin:/Users/lixuejian/Downloads/Xcode.app/Contents/Developer/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
3.制作wget的替身到xcode的PATH目录下 注:前面目录为wget所在目录,后面目录为xcode环境变量目录
ln -s /opt/homebrew/Cellar/wget/1.21.2/bin/wget /Users/lixuejian/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
|