Realm-cocoa: Realm fails to install via CocoaPods. Problem with build.sh file on El Capitan.

Created on 13 Oct 2015  路  9Comments  路  Source: realm/realm-cocoa

$ pod install
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Installing Realm (0.95.3)
[!] /bin/bash -c 
set -e
sh build.sh cocoapods-setup

: command not found
: command not found
: invalid option namet: pipefail
: invalid option4: set: -
set: usage: set [--abefhkmnptuvxBCHP] [-o option] [arg ...]

The result doesn't depend on the version of Realm.
I've tried:

pod 'Realm'
pod 'Realm', '=0.95.2'
pod 'Realm', '=0.95.0'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
inhibit_all_warnings!
use_frameworks!
pod 'RealmSwift', '0.95.2'
pod --version
0.39.0

All other pods work well. I guess, it's somehow related to that I have El Capitan, OS X 10.11 (15A284).
I reinstalled a public release from AppStore again. It didn't change anything.
As I see build.sh file has Windows-style line endings. Therefore, I can't understand why everyone else has no problems with CocoaPods version on Realm.
Using static framework is not an option for me because of 3rd party libraries that depend on Realm CocoaPod.

T-Help

Most helpful comment

Hey this was enough for me
git config --global core.autocrlf input
didnt have to re install ruby and homebrew

All 9 comments

are you using a custom shell, by any chance? Realm's installation script depends on bash.

$ echo $SHELL
/bin/bash

We've had one report of this happening several months ago as well, but we were never able to reproduce the issue or figure out why it was happening. See #1683.

Can you think of anything about your computer's configuration that might cause this @asqar? I still have no clue why this could happen.

I installed beta version of El Capitan. Then upgraded to the public release from the Mac AppStore.
Yesterday I re-installed El Capitan from the Mac AppStore again, bus it didn't help.

I've tried to reinstall CocoaPods several times.

My ruby version is:

$ ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin15]
$ which sh
/bin/sh
$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)
Copyright (C) 2007 Free Software Foundation, Inc.

I have problems with Homebrew updates if it matters.

$ brew update
error: The following untracked working tree files would be overwritten by merge:
    Library/Homebrew/extend/enumerable.rb
Please move or remove them before you can merge.
Aborting
Error: Failure while executing: git pull --quiet origin refs/heads/master:refs/remotes/origin/master

I've tried to checkout Realm and run build.sh manually.

$ bash build.sh cocoapods-setup
'/scripts/swift-version.sh: line 1: syntax error near unexpected token `{

I've seen similar errors in shell scripts in other contexts when the line endings of the files were incorrect (e.g., Windows-style CRLF line endings on Unix). Would you mind posting the output of the following command so we can see if the script has the expected line endings:

xxd scripts/swift-version.sh | head

As I worried and @bdash suggested, I had some _misconfigured_ settings for line endings.

I ran:

git config --global core.autocrlf input

Then completely re-installed Homebrew and Ruby.

sudo rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )"
brew install ruby

Now everything is cool.

Wow, I'm happy you two were able to resolve this. The previous report of this issue had really puzzled me.

Hey this was enough for me
git config --global core.autocrlf input
didnt have to re install ruby and homebrew

I suffered the same issue, to fix it I removed and re-installed cocoapods by gem instead of brew and it works.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ishidakei picture ishidakei  路  3Comments

Bogidon picture Bogidon  路  3Comments

matteodanelli picture matteodanelli  路  3Comments

TheHmmka picture TheHmmka  路  3Comments

carvalho-oak picture carvalho-oak  路  3Comments