Installing Cocoapods on OS X El Capitan error
Asked Answered
P

9

29

First of all. I updated to El Capitan because of iOS 9.3 and it's support only in xCode 7.3.

After update I discovered that pod command isn't working. I executed:

sudo gem install cocoapods
ERROR:  Error installing cocoapods:
    activesupport requires Ruby version >= 2.2.2.

So my problem is that I can't install cocoapods. I don't know nothing about gems and ruby stuff. Does somebody know how to handle this?

I had second OS X with El Capitan 10.11.4 and everything went ok so I don't know from where this issue is coming from.

UPDATE: 5 April 2016

I executed several commands on terminal for more info:

Kapucha:~ kapucha$ which ruby
/usr/bin/ruby
Kapucha:~ kapucha$ which gem
/usr/bin/gem
Kapucha:~ kapucha$ which brew
/usr/local/bin/brew
Kapucha:~ kapucha$ which rvm
/Users/kapucha/.rvm/bin/rvm

Versions:

Kapucha:~ kapucha$ ruby --version
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]
Kapucha:~ kapucha$ gem --version
2.2.2
Kapucha:~ kapucha$ brew --version
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir': Permission denied - /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15 (Errno::EACCES)
Kapucha:~ kapucha$ rvm --version
rvm 1.27.0 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]

.bash_profile file and .profile

Kapucha:~ kapucha$ cat .bash_profile
export JAVA_HOME=$(/usr/libexec/java_home)
. ~/.bashrc
source ~/.profile

Kapucha:~ kapucha$ cat .profile
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

rvm list and rvm info

Kapucha:local kapucha$ rvm list

rvm rubies


# No rvm rubies installed yet. Try 'rvm help install'.

Kapucha:local kapucha$ rvm info

system:

  system:
    uname:       "Darwin Kapucha.local 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64"
    system:      "osx/10.11/x86_64"
    bash:        "/bin/bash => GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)"
    zsh:         "/bin/zsh => zsh 5.0.8 (x86_64-apple-darwin15.0)"

  rvm:
    version:      "rvm 1.27.0 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]"
    updated:      "18 hours 23 minutes 25 seconds ago"
    path:         "/Users/kapucha/.rvm"

  homes:
    gem:          "not set"
    ruby:         "not set"

  binaries:
    ruby:         "/usr/bin/ruby"
    irb:          "/usr/bin/irb"
    gem:          "/usr/bin/gem"
    rake:         "/usr/bin/rake"

  environment:
    PATH:         "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/filipkotwicki/dev/tools/android-sdk-macosx/platform-tools:~/bin:/opt/X11/bin:/usr/local/git/bin:/Users/kapucha/.rvm/bin:/Users/kapucha/.rvm/bin"
    GEM_HOME:     ""
    GEM_PATH:     ""
    MY_RUBY_HOME: ""
    IRBRC:        ""
    RUBYOPT:      ""
    gemset:       ""

When I'm triying to install Ruby with rvm

Kapucha:local kapucha$ rvm install 2.2.2
Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/osx/10.11/x86_64/ruby-2.2.2.tar.bz2
Checking requirements for osx.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir': Permission denied - /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15 (Errno::EACCES)
...
ERROR: '/bin' is not writable - it is required for Homebrew, try 'brew doctor' to fix it!
Requirements installation failed with status: 1.

Tried brew doctor with the same result:

Kapucha:local kapucha$ brew doctor
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir': Permission denied - /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15 (Errno::EACCES)
Pensile answered 4/4, 2016 at 12:6 Comment(0)
P
3

Finally I solved this problem.

The goal was to install cocoapods but there was errors that I need ruby >= 2.2.2.

Installation rvm install 2.2 didn't completed because of error:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir': Permission denied - /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15 (Errno::EACCES)

Running brew was resulting with the same error. So I decided to fix brew first. It was fixed by uninstalling and installing it again. It wasn't easy. Uninstall script did't work because I didn't have .git folder in /usr/local.

I decided to provide .git folder.

I cloned git clone https://github.com/Homebrew/homebrew.git to some temp folder and then cp -r .git /usr/local/ so in the end I have .git folder in my brew folder /usr/local. After this I was able to Uninstall and Install fresh brew on El Capitan. Take a look at Part 2 of this link.

With working brew and fixed permissions for El Capitan in /usr/local according to this I was able to install ruby with rvm:

rvm install 2.2
rvm use 2.2

and install cocapods finally for El Capitan:

sudo gem install -n /usr/local/bin cocoapods
Pensile answered 5/4, 2016 at 11:52 Comment(0)
U
94

Here's a simpler solution than the other 'install homebrew/use rvm' suggestions -- first install an old version of 'activesupport' (which is both compatible with ruby 2.0 and with cocoapods) and then install cocoapods.

sudo gem install activesupport -v 4.2.6
sudo gem install cocoapods

Here's the cocoapods bug report that suggested this workaround.

Undercroft answered 6/7, 2016 at 12:56 Comment(2)
And keep patience and wait for a while after ($sudo gem install cocoapods) :P . It takes time. No matter how fast your internet speed is.Lagrange
still I am getting ERROR: Error installing cocoapods: zeitwerk requires Ruby version >= 2.5. mac OS: Mojave, version : 10.1406Griseous
H
6
  1. Install Homebrew using this command

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    
  2. Now that we have Homebrew installed, we can use it to install Ruby. We're going to use rbenv to install and manage our Ruby versions. To do this, run the following commands in your Terminal:

    brew install rbenv ruby-build
    
  3. Now install ruby

    echo 'if which rbenv > /dev/null;
    
    then eval "$(rbenv init -)";
    
    fi' >> ~/.bash_profilesource ~/.bash_profile
    
    rbenv install 2.3.1
    
    rbenv global 2.3.1 
    
    ruby -v
    
  4. install cocoapods

    sudo gem install cocoapods
    
Homeless answered 5/7, 2016 at 11:20 Comment(0)
P
3

Finally I solved this problem.

The goal was to install cocoapods but there was errors that I need ruby >= 2.2.2.

Installation rvm install 2.2 didn't completed because of error:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir': Permission denied - /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15 (Errno::EACCES)

Running brew was resulting with the same error. So I decided to fix brew first. It was fixed by uninstalling and installing it again. It wasn't easy. Uninstall script did't work because I didn't have .git folder in /usr/local.

I decided to provide .git folder.

I cloned git clone https://github.com/Homebrew/homebrew.git to some temp folder and then cp -r .git /usr/local/ so in the end I have .git folder in my brew folder /usr/local. After this I was able to Uninstall and Install fresh brew on El Capitan. Take a look at Part 2 of this link.

With working brew and fixed permissions for El Capitan in /usr/local according to this I was able to install ruby with rvm:

rvm install 2.2
rvm use 2.2

and install cocapods finally for El Capitan:

sudo gem install -n /usr/local/bin cocoapods
Pensile answered 5/4, 2016 at 11:52 Comment(0)
A
3

I used this command and work right:-

sudo gem install activesupport -v 4.2.6
 sudo gem install cocoapods
Achelous answered 26/7, 2016 at 9:46 Comment(1)
Don't post duplicate answer - better up-voting the original from which you had copiedPtarmigan
E
0

activesupport gem which Cocoapods depends on requires Ruby version greater than 2.2.2 (see here).

What version of Ruby are you using (type ruby --version)? Maybe your second OS X system is using the system Ruby version (you can check it by typing which ruby).

Probably you need to install newer version of Ruby (for example 2.2.3). I recommend RVM for installation and management of Ruby versions on your machine.

Emlin answered 4/4, 2016 at 14:30 Comment(5)
Hi Aleksander. I updated my answer with more environment info. You can find there ruby --version and much more. I'm not sure but interesting is that brew is throwing permission error when I want to check version.Pensile
Could you put rvm list also and rvm info? From which ruby you can see that you are using the system version of Ruby not the RVM one.Emlin
I updated my question with rvm list and rvm info. I tried to execute rvm install 2.2.2 but I'm getting the same errors from brew like in brew --version. Simply when I execute this command brew I get the same error.Pensile
Thank U very much for trying help. You point me in the right direction. I added answer that solved my problem. It wasn't easy for me as I don't know almost nothing about ruby, rvm and gems.Pensile
No problem. Glad that I helped. :)Emlin
B
0

install homebrew using below command:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

then install cocoapods without using sudo

gem install cocoapods

Begley answered 5/7, 2016 at 7:37 Comment(0)
M
0

Please install latest version of Ruby and RVM(Ruby version manager) from this link.

Then run "sudo install cocoapods"

Merissa answered 25/7, 2016 at 14:18 Comment(0)
D
0

El Capitan 10.11.3

1)$ sudo gem install activesupport -v 4.2.6

2)$ sudo gem install -n /usr/local/bin cocoapods

Dragonfly answered 6/9, 2016 at 11:41 Comment(0)
G
0

The easiest way that i have found is to use brew install cocoapods command. it will take care all the issue. and also recommend what todo..

Glimpse answered 9/8, 2023 at 6:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.