がべーじこれくしょん

技術系とかいろいろ

fastlaneのbundle exec pod installがRealmの部分でコケるときの対処法

TL;DR

  • fastlaneのbundle exec pod installが落ちる
  • sudo xcode-select -s /Applications/Xcode.appを実行すれば治る
  • Realm v2.10.1 + Xcode9に限ってこのエラーが発生する模様

環境

エラーログ

...
[16:00:35]: $ bundle exec pod install
...
[16:00:36]: ▸ Installing Realm (2.10.1)
[16:01:01]: ▸ [!] /bin/bash -c
[16:01:01]: ▸ set -e
[16:01:01]: ▸ sh build.sh cocoapods-setup
[16:01:01]: ▸
[16:01:01]: Exit status of command 'bundle exec pod install' was 1 instead of 0.
Analyzing dependencies
Pre-downloading: `CocoaLumberjack` from `https://github.com/CocoaLumberjack/CocoaLumberjack.git`, commit `1e24be125f576a881790ac82124bb8c65d7dd018`
Pre-downloading: `IDMPhotoBrowser` from `https://github.com/ideaismobile/IDMPhotoBrowser`, commit `469246909043cdb71a9cc9d83b0dd4b86ad79c46`
Pre-downloading: `KLCPopup` from `https://github.com/jmascia/KLCPopup`, commit `ba17c211cbfa62761fddb58201f9381126ca1fe7`
Pre-downloading: `SDWebImage` from `https://github.com/rs/SDWebImage.git`, commit `740cd7f0902b5e9eddf4a52ff76ec630fdf753bc`
Pre-downloading: `evernote-cloud-sdk-ios` from `https://github.com/tamanyan/evernote-cloud-sdk-ios.git`, commit `bb06be1c41fda705c34fbc35d07db45b48c733b8`
Pre-downloading: `pop` from `https://github.com/facebook/pop.git`, commit `b1b1ca2c5da35548357fe1b3aa901d7e5094532f`
Downloading dependencies
Using AdobeMobileSDK (4.13.5)
Installing CocoaLumberjack (2.2.0)
Using DACircularProgress (2.3.1)
Using DZNEmptyDataSet (1.7.3)
Using GZIP (1.1.1)
Installing IDMPhotoBrowser (1.8.4)
Installing KLCPopup (1.1)
Using OHHTTPStubs (4.3.0)
Installing Realm (2.10.1)
[!] /bin/bash -c
set -e
sh build.sh cocoapods-setup
...

対処法

https://github.com/realm/realm-cocoa/issues/5337

このIssueが参考になりました。以下コマンドを実行すれば大丈夫です。

sudo xcode-select -s /Applications/Xcode.app