M1 Macでプロジェクトを立ち上げたところ、SwiftLintが起動しなかった。
行ったこと
基本的にはこちらに記載の通りに進めていった。
1. Rossetaでターミナルを開く
ターミナルを右クリック→情報→[ Rossettaで開く ] にチェックして開く
2. swiftLintをhomebrewでインストール
arch -arm64 brew reinstall swiftLint
3. 下記をXcodeのRunScriptに書き込む
if which swiftlint >/dev/null; then
swiftlint
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
4. ビルドしてみると、下記エラーが発生
"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
解決
RunScriptをみるとswiftlint のpathが上手く取得できなかったと思われる。
こちらの記事にあるように、下記でスクリプトを修正すると解決した
if test -d /opt/homebrew/bin; then
PATH=/opt/homebrew/bin/:$PATH
fi
if which swiftlint >/dev/null; then
swiftlint
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
Homebrewをインストールした際にpathが変わっていたことがそもそもの原因だったため、Homebrewのpathも下記のように変更しておいた。
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/ユーザ名/.zprofile
コメント