I am using a setup on Xcode that runs the following script for 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
I am unable to use pods
or brew.
To make SwiftLint
available I added the following to my path by using
vim ~/.bash_profile
export PATH
export PATH=$PATH:/Users/me/Documents/SwiftLint
and I can now access SwiftLint
everywhere through the command line.
However, Xcode still displays the message that SwiftLint is not installed.
I can't use another method to install Swiftlint or change the script. I guess there is a problem with my export path - what is it?
When running scripts, .bash_profile
will not be considered. I would just prepend your script like this:
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
fi
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With