realm-swift: Can't install realmswift 2.10.1 with cocoapods and xcode 9

I upgrade to xcode 9 last night and I tried updating my realmswift pod to be swift 3.2 compatible

Goals

install realm with cocoapods ‘pod install --verbose’

Expected Results

pod install finishes successful

Actual Results

-> Installing Realm (2.10.1)

Git download Git download $ /usr/bin/git clone https://github.com/realm/realm-cocoa.git /var/folders/ml/2x_8p6kx15q3979kssq7s75h0000gn/T/d20170924-6578-7tcmvt –template= --single-branch --depth 1 --branch v2.10.1 Cloning into ‘/var/folders/ml/2x_8p6kx15q3979kssq7s75h0000gn/T/d20170924-6578-7tcmvt’… Note: checking out ‘76f0f67e59d8ebff0af7b91adfc77056d2135858’.

 You are in 'detached HEAD' state. You can look around, make experimental
 changes and commit them, and you can discard any commits you make in this
 state without impacting any branches by performing another checkout.

 If you want to create a new branch to retain commits you create, you may
 do so (now or later) by using -b with the checkout command again. Example:

   git checkout -b <new-branch-name>

 $ /usr/bin/git -C
 /var/folders/ml/2x_8p6kx15q3979kssq7s75h0000gn/T/d20170924-6578-7tcmvt
 submodule update --init --recursive
 Submodule 'Realm/ObjectStore' (https://github.com/realm/realm-object-store.git) registered for path 'Realm/ObjectStore'
 Cloning into '/private/var/folders/ml/2x_8p6kx15q3979kssq7s75h0000gn/T/d20170924-6578-7tcmvt/Realm/ObjectStore'...
 Submodule path 'Realm/ObjectStore': checked out '4de03a96f86848297c36e89b7e9da49bf8b4d46d'
 Submodule 'external/catch' (https://github.com/philsquared/Catch) registered for path 'Realm/ObjectStore/external/catch'
 Submodule 'external/pegtl' (https://github.com/ColinH/PEGTL) registered for path 'Realm/ObjectStore/external/pegtl'
 Cloning into '/private/var/folders/ml/2x_8p6kx15q3979kssq7s75h0000gn/T/d20170924-6578-7tcmvt/Realm/ObjectStore/external/catch'...
 Cloning into '/private/var/folders/ml/2x_8p6kx15q3979kssq7s75h0000gn/T/d20170924-6578-7tcmvt/Realm/ObjectStore/external/pegtl'...
 Submodule path 'Realm/ObjectStore/external/catch': checked out 'ee67ac6b7c3595251342671485c65cf81d725896'
 Submodule path 'Realm/ObjectStore/external/pegtl': checked out '3c4128a7e7e1288eb746418ea60c41477358f26a'

Running prepare command $ /bin/bash -c set -e sh build.sh cocoapods-setup [!] /bin/bash -c set -e sh build.sh cocoapods-setup

/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/executable.rb:69:in execute_command' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/executable.rb:27:in block in executable’ /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/pod_source_preparer.rb:66:in block (2 levels) in run_prepare_command' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/pod_source_preparer.rb:60:in chdir’ /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/pod_source_preparer.rb:60:in block in run_prepare_command' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:64:in section’ /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/pod_source_preparer.rb:59:in run_prepare_command' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/pod_source_preparer.rb:37:in prepare!’ /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/downloader/cache.rb:202:in copy_and_clean' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/downloader/cache.rb:159:in block (2 levels) in uncached_pod’ /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/downloader/cache.rb:157:in each' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/downloader/cache.rb:157:in block in uncached_pod’ /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/downloader/cache.rb:181:in call' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/downloader/cache.rb:181:in in_tmpdir’ /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/downloader/cache.rb:153:in uncached_pod' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/downloader/cache.rb:33:in download_pod’ /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/downloader.rb:42:in download' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/pod_source_installer.rb:120:in download_source’ /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/pod_source_installer.rb:60:in install!' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:364:in install_source_of_pod’ /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:329:in block (2 levels) in install_pod_sources' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:85:in titled_section’ /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:328:in block in install_pod_sources' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:320:in each’ /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:320:in install_pod_sources' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:163:in block in download_dependencies’ /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:64:in section' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:161:in download_dependencies’ /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:117:in install!' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/command/install.rb:41:in run’ /Library/Ruby/Gems/2.0.0/gems/claide-1.0.2/lib/claide/command.rb:334:in run' /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/lib/cocoapods/command.rb:52:in run’ /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.3.1/bin/pod:55:in <top (required)>' /usr/local/bin/pod:23:in load’ /usr/local/bin/pod:23:in `<main>’

Steps to Reproduce

I followed the suggested steps to clear caches several time, but always the result above

pod cache clean Realm pod cache clean RealmSwift pod deintegrate || rm -rf Pods pod install --verbose

Realm framework version: 2.10.1

Realm Object Server version: ?

Xcode version: 9.0

iOS/OSX version: 11

Dependency manager + version: cocoapods 1.3.1

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 33 (10 by maintainers)

Most upvoted comments

By the way, it didn’t work for me ‘out of the box’, I got this:

Installing Realm (2.10.2) [!] /bin/bash -c set -e sh build.sh cocoapods-setup

WARNING: The active Xcode command line tools, as returned by /Library/Developer/CommandLineTools, are not from Xcode. The newest version of Xcode will be used instead. No version of Xcode could be found

I worked around using your command ‘sudo xcode-select -s /Applications/Xcode.app’. Might be an idea to add that command to the error message?

Same issue. Xcode 9 and latest Realm version.

I spent a few minutes debugging this on a user’s machine. The underlying cause looks to be that our script for detecting which Xcode and Swift version should be used does not correctly handle the currently-selected command-line tools being Xcode’s standalone command-line tools (/Library/Developer/CommandLineTools) rather than command-line tools within Xcode itself. Many thanks to Adrian for taking his time to help me look into this.

I’d appreciate some information from others that are seeing this (@westd?), namely the output of xcode-select -p and verification that you’re seeing a failure immediately after pod install --verbose runs sh build.sh cocoapods-setup, to help confirm that people are all seeing problems for the same reason.

As an immediate workaround for anyone hitting this issue, you can do sudo xcode-select -s /Applications/Xcode.app to select the command-line tools bundled within Xcode. I’ll look to make a more complete fix in Realm.

‘sudo xcode-select -s /Applications/Xcode.app’, Danke!

for me the problem was happening because I have multiple versions of Xcode (to support older swift) by simply ensure Xcode is named Xcode in the applications dir resolved the issue

@westd sudo xcode-select -s /Applications/Xcode.app is a life saver! ❤️

@bdash v2.10.2 has solved problem. Thank you!

Same issue. Xcode 9, Hight Sierra and latest Realm version.