我在Xcode上使用了一个安装程序,它为SwiftLint运行以下脚本
if which $PATH/swiftlint >/dev/null; then
$PATH/swiftlint
elif which $HOME/.brew/bin/swiftlint >/dev/null; then
$HOME/.brew/bin/swiftlint
elif which ~/Softwares/homebrew/bin/swiftlint >/dev/null; then
~/Softwares/homebrew/bin/swiftlint
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi我无法使用pods或brew。
为了使SwiftLint可用,我使用vim ~/.bash_profile将以下内容添加到我的路径中
export PATH
export PATH=$PATH:/Users/me/Documents/SwiftLint现在,我可以通过命令行在任何地方访问SwiftLint。
但是,Xcode仍然显示未安装SwiftLint的消息。
我不能使用其他方法安装Swiftlint或更改脚本。我猜我的导出路径有问题-它是什么?
发布于 2019-11-07 16:51:18
运行脚本时,不会考虑.bash_profile。我会像这样预置你的脚本:
if test -d "${HOME}/Documents/SwiftLint"; then
PATH="${HOME}/Documents/SwiftLint:${PATH}"
fi
export PATH
if ! which swiftlint >/dev/null 2>&1; then
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint" >&2
fihttps://stackoverflow.com/questions/58741453
复制相似问题