LoginSignup
31
22

More than 3 years have passed since last update.

Command 〜 failed with a nonzero exit code

Posted at

Xcodeで開発をしていたら必ず目にするこのエラー。
ビルド時に起こりうるエラー。

  • Command CompileXIB failed with a nonzero exit code
  • Command CompileStoryboard failed with a nonzero exit code
  • Command PhaseScriptExecution failed with a nonzero exit code
  • etc.

何かしらに失敗したらしいけど、なんで!!!
非常に困るエラー。専門的には自分は分からないですが、対処法をいくつか記載します。

直近Xcode11.0で私が直面したエラー

ライブラリのxibファイルにて。

エラー:
Command CompileXIB failed with a nonzero exit code

色々試しましたが、全く解決せず。それもそのはずでした。

Xcode11.1 Release Notes
https://developer.apple.com/documentation/xcode_release_notes/xcode_11_1_release_notes

Resolved Issues
Fixed a crash that sometimes occurred when compiling XIB files in iOS projects that backwards deploy to iOS versions earlier than 13.0. (55271752)

Xcode11.0では、iOS13.0よりも古いやつでデプロイされたXIBファイルは、クラッシュすることがあるだと。。

つまりXcode11.0では無力でした :innocent:
Xcode11.1にしたら直りました。
古いライブラリを使っていた自分が悪いということでしょう。
あと、Release Noteをちゃんとチェックするのは大事だと改めて思いました。

基本の対処法

基本はクリーン系で直ります。以下を試しましょう。

  • XcodeでClean Build Folder
  • /Library/Developer/Xcode/DerivedDataの削除
  • Xcodeの再起動
  • Simulatorでアプリアンインストール、再起動

PhaseScriptExecution

これはXcodeがKeyChainにアクセスできなくて起きている可能性があります。
KeyChainのロックON/OFFをしてみましょう。

参考: https://qiita.com/kamata1729/items/885ae2cf2a9b06594adf

まとめ

まだまだ他のケースが見つかれば追記していきます。

その他参考資料

31
22
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
31
22