realm-swift: Realm fails to install via CocoaPods

Goals

Install the RealmSwift CocoaPod

Expected Results

Realm should install via CocoaPods successfully

Actual Results

Install fails at sh build.sh cocoapods-setup

Sheels-MBP:Zwickau sheelpatel$ pod install --verbose
  Preparing

Analyzing dependencies

Inspecting targets to integrate
  Using `ARCHS` setting to build architectures of target `Pods-Zwickau`: (``)

Finding Podfile changes
  A RealmSwift

Resolving dependencies of `Podfile`

Comparing resolved specification to the sandbox manifest
  A Realm
  A RealmSwift

Downloading dependencies

-> Installing Realm (2.10.1)
 > Git download
 > Git download
     $ /usr/bin/git clone https://github.com/realm/realm-cocoa.git /var/folders/1v/mmh339p56bg_vqg_4jjm8ljr0000gn/T/d20170919-95058-fca244 --template= --single-branch --depth
     1 --branch v2.10.1
     Cloning into '/var/folders/1v/mmh339p56bg_vqg_4jjm8ljr0000gn/T/d20170919-95058-fca244'...
     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/1v/mmh339p56bg_vqg_4jjm8ljr0000gn/T/d20170919-95058-fca244 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/1v/mmh339p56bg_vqg_4jjm8ljr0000gn/T/d20170919-95058-fca244/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/1v/mmh339p56bg_vqg_4jjm8ljr0000gn/T/d20170919-95058-fca244/Realm/ObjectStore/external/catch'...
     Cloning into '/private/var/folders/1v/mmh339p56bg_vqg_4jjm8ljr0000gn/T/d20170919-95058-fca244/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



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

Steps to Reproduce

  1. Have a pod file with the following contents:
platform :ios, '10.0'

target 'Zwickau' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Zwickau
  pod 'RealmSwift'

end
  1. run pod install --verbose

Code Sample

N / A

Version of Realm and Tooling

Realm framework version: 2.10.1

Realm Object Server version: N/A

Xcode version: Version 9.0 (9A235)

iOS/OSX version: Running on Mac OS 10.12.6, targeting iOS 10

Dependency manager + version: ruby: ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin16] rvm: 1.29.3 CocoaPods: 1.3.1

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (5 by maintainers)

Most upvoted comments

Note that when trying again with CocoaPods it’s necessary to clear out its cached copy of the Realm pod per our instructions on troubleshooting CocoaPods issues:

pod cache clean Realm
pod cache clean RealmSwift
pod deintegrate || rm -rf Pods
pod install --verbose
rm -rf ~/Library/Developer/Xcode/DerivedData

I had same issue today and after 2 hours research I fixed it successfully. With MacOS you should add some settings to .bash_profile change :8787 port to proxy port(shadowsock or astrill)

#proxy 
PROXY='127.0.0.1:8787'
defp=$PROXY
#No Proxy
function noproxy
{
    unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY all_proxy ALL_PROXY ftp_proxy FTP_PROXY dns_proxy DNS_PROXY JAVA_OPTS GRADLE_OPTS MAVEN_OPTS
    echo "clear proxy done"
}

function setproxy
{
    if [ $# -eq 0 ]
    then
        inArg=$defp
    else
        inArg=$1
    fi
    HOST=$(echo $inArg |cut -d: -f1)
    PORT=$(echo $inArg |cut -d: -f2)
    http_proxy=http://$HOST:$PORT
    HTTP_PROXY=$http_proxy
    all_proxy=$http_proxy
    ALL_PROXY=$http_proxy
    ftp_proxy=$http_proxy
    FTP_PROXY=$http_proxy
    dns_proxy=$http_proxy
    DNS_PROXY=$http_proxy
    https_proxy=$http_proxy
    HTTPS_PROXY=$https_proxy
    JAVA_OPTS="-Dhttp.proxyHost=$HOST -Dhttp.proxyPort=$PORT -Dhttps.proxyHost=$HOST -Dhttps.proxyPort=$PORT"
    GRADLE_OPTS="-Dgradle.user.home=$HOME/.gradle"
    MAVEN_OPTS=$JAVA_OPTS
    no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com,.coding.net,192.168.99.100,.ruby-china.org"
    echo "current proxy is ${http_proxy}"
    export no_proxy http_proxy HTTP_PROXY https_proxy HTTPS_PROXY all_proxy ALL_PROXY ftp_proxy FTP_PROXY dns_proxy DNS_PROXY JAVA_OPTS GRADLE_OPTS MAVEN_OPTS
}

setproxy

then reopen terminal. it will show current proxy is http://127.0.0.1:YOURPORT

you can use setproxy $PROXY or setproxy 127.0.0.1:xxxx and use noproxy clear the proxy setting.

Anyway I success with this solution for same issue from china.