When installing swiftlint with homebrew everything installs correctly but when I open xcode I see the message that swiftlint isn't installed. I read this issue & it say's the homebrew installs under this path now /opt/homebrew
with apple silicon & xcode looks for swiftlint in /usr/local
? How can I get xcode to reconige that I have in fact installed swiftlint. Swiftlint is definitely installed, from terminal I can type swiftlint & see all the commands.
SwiftLint is an open-source tool to enforce Swift style and conventions. It is developed by Realm. You can set your coding style rules and force them during development. SwiftLint has a command-line tool, Xcode plugin, AppCode, and Atom integration. So, it always fits your development environment.
I was unable to find how to modify the $PATH variable for Xcode build phase scripts permanently. This script will add the Apple Silicon homebrew path to your scripts PATH for the duration of the run. I’ve tested this on an M1 and Intel Mac and it works for both.
# Adds support for Apple Silicon brew directory
export PATH="$PATH:/opt/homebrew/bin"
if which swiftlint; then
swiftlint autocorrect && swiftlint
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
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