Pod setup failure - cocoa

Right after installing cocoapods with brew and running pod setup it exists with the following messages:
Setting up CocoaPods master repo
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/yaml.rb:5:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
Assertion failed: (0 && "LoadedImage not found"), function findLoadedImage, file /BuildRoot/Library/Caches/com.apple.xbs/Sources/libdyld/dyld-655.1/dyld3/ClosureBuilder.cpp, line 469.
Abort trap: 6

This is most likely an issue with your ruby config. I use RVM to manage my ruby installations and running rvm get stable --auto-dotfiles fixed the issue.

Related

How to get Cocoapods running with RVM?

Unfortunately, I recently upgraded the system Ruby to 2.3 on my Mac. Since I have to use Cocoapods 0.39 for a specific project which does not properly work, I would like to use an older version of Ruby. For this purpose, I installed RVM and then switched to ruby-2.2-head:
> \curl -sSL https://get.rvm.io | bash -s stable --ruby
> rvm install 2.2-head
> rvm use 2.2-head --default
This worked fine. Then I tried to install Cocoapods and got the usual error message:
> rvmsudo gem install cocoapods
Warning: can not check `/etc/sudoers` for `secure_path`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. Run:
export rvmsudo_secure_path=1
to avoid the warning, put it in shell initialization file to make it persistent.
In case there is no `secure_path` in `/etc/sudoers`. Run:
export rvmsudo_secure_path=0
which I silenced by chosing the second option. Then I checked Cocoapods and got a fantastic error message:
> pod --version
/Users/bastian/.rvm/rubies/ruby-2.2-head/lib/ruby/site_ruby/2.2.0/rubygems.rb:250:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException)
from /Users/bastian/.rvm/rubies/ruby-2.2-head/lib/ruby/site_ruby/2.2.0/rubygems.rb:278:in `activate_bin_path'
from /Users/bastian/bin/pod:22:in `<main>'
Furthermore, Cocoapods is not listed with the following command:
> gem list
*** LOCAL GEMS ***
bigdecimal (1.2.6)
io-console (0.4.3)
json (1.8.1)
psych (2.0.8)
rake (10.4.2)
rdoc (4.2.0)
Cocoapods seems to be installed into the wrong directory:
> which pod
/Users/bastian/bin/pod
So if I switch back to the system Ruby, the pod --version command returns 0.39.0.
I guess that somehow Cocoapods was not installed with the RVM Ruby but rather with the system version. What did I do wrong?
With the help of "How to get RVM to set correct gem path" I was able to solve the problem. I don't know why but the removal of the single entry --user from .gemrc solved this problem for me. Since the file only contained this one line I just renamed it and reinstalled Cocoapods:
> mv ~/.gemrc ~/.gemrc_backup
> gem install cocoapods`
Now Cocoapods is working again as it resides at the correct path:
> which pod
/Users/bastian/.rvm/gems/ruby-2.2-head/bin/pod

Issue with Ruby gems (broken?) trying to get compass to work in npm

I am not a Ruby expert but wanted to figure out what is going on as I am trying to get compass working in a node app but my Ruby seems broken. Typing:
ruby --version
gets me:
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]
I have Homebrew installed and have previously had issues with Ruby versions but it seems like it is installed and working. However when I enter a request with gem I get this error:
$ gem -h
Error loading RubyGems plugin "/Users/user_dir/.rvm/gems/ruby-2.1.1#global/gems/executable-hooks-1.3.1/lib/rubygems_plugin.rb": dlopen(/Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle, 9): Symbol not found: _SSLv2_client_method
Referenced from: /Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle
Expected in: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
in /Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle - /Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle (LoadError)
Error loading RubyGems plugin "/Users/user_dir/.rvm/gems/ruby-2.1.1#global/gems/gem-wrappers-1.2.4/lib/rubygems_plugin.rb": dlopen(/Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle, 9): Symbol not found: _SSLv2_client_method
Referenced from: /Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle
Expected in: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib in /Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle - /Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle (LoadError)
RubyGems is a sophisticated package manager for Ruby. This is a
basic help message containing pointers to more information.
Usage:
gem -h/--help
gem -v/--version
gem command [arguments...] [options...]
Examples:
gem install rake
gem list --local
gem build package.gemspec
gem help install
Further help:
gem help commands list all 'gem' commands
gem help examples show some examples of usage
gem help platforms show information about platforms
gem help <COMMAND> show help on COMMAND
(e.g. 'gem help install')
gem server present a web page at
http://localhost:8808/
with info about installed gems
Further information:
http://guides.rubygems.org
I noticed the reference to openssl but couldn't find any issues online about that.
I have tried installing compass on npm and RVM and Homebrew, so, at the moment, I don't know what versions are being used and where to begin trying to resolve the issue.
If you know what the issue is please let me know, or if you need further info about my system.
I looked at: "Ruby Bundle Symbol not found: _SSLv2_client_method (LoadError)" and
"Error loading RubyGems plugin ,openssl.bundle (LoadError)".
I didn't add npm or node tags as I am quite sure it is a Ruby issue, but left it in the question as I did try to install compass there as well.
I have tried fixing RVM, Homebrew etc., but it is still broken.
Are you using brew?
If so, brew update or brew upgrade breaks the Ruby runtime which is what caused a similar error for me.
The following solved the issue for me:
brew rm openssl
brew cleanup openssl
brew install openssl
rvm reinstall ruby
gem install compass
EDIT:
I finally found out that RVM has a default version, so every time I installed a new version it would revert to the old one (I guess this one had errors which is why I didn't notice the version issue).
If you go to:
~/.rvm/gems/
There will be a list of ruby versions and a default folder at the top. Following this page and entering:
rvm --default use 2.1.5
Fixed my problems (for now...)
ORIGINAL:
I tried a lot of different things but eventually got it to work, I have broken this answer down into the list of things I think may have contributed to the result as there were lots of things that didn't work.
This answer to an SO question I found led me down this path.
I reinstalled ruby but because the version in the answer(1.9.3) was older than 2.1.1p76 I just entered:
rvm get stable
then:
rvm reinstall ruby
this kept me on 2.1.1p76, then:
rvm gemset pristine
upgraded gem to 2.4.3
This bit is strange but I then tried to install compass in NPM and it worked but still would not run, then checking my ruby version again gave me 2.1.5p273 (there were no upgrades in between unless RVM gemset pristine updated ruby...).
I then tried the mygemset code from the SO answer but got more errors so I decided to just run
gem install bundler
This seemed to work, so I tried:
gem install compass
Which I had tried many times but this time it worked. It installed ffi-1.9.6.gem and 9 gems which I assume were dependancies.
The NPM package then worked and I currently don't have any errors showing up in ruby.
NOTE: I am not going to accept this answer as I don't really know why it worked, if you follow this be aware I don't know ruby and this was just to get compass working in NPM.
NOTE: Many answers had rbenv as a package manager, I wanted to resolve the situation with what was already on the system so I continued to work with RVM.

Gem install error due to invalid ssl using rbenv

I'm trying to install a new gem (gem install lunchy), but am getting the following error due to the ssl certificate:
ERROR: Loading command: install (LoadError)
dlopen(/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.3.0/openssl.bundle, 9): Symbol not found: _SSLv2_client_method
Referenced from: /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.3.0/openssl.bundle
Expected in: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
in /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.3.0/openssl.bundle - /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.3.0/openssl.bundle
ERROR: While executing gem ... (NoMethodError)
undefined method 'invoke_with_build_args' for nil:NilClass
I've tried a number of fixes:
Tried gem update --system per this answer bundle install fails with SSL certificate verification error but get the same error on that command.
Tried brew install openssl followed by brew link openssl --force per this question but to no avail: OpenSSL error installing ruby 2.0.0-p195 on Mac with rbenv
Even tried reinstalling rbenv and ruby but that didn't work either, still get the same error.
The Ruby being executed in this error is not one installed by rbenv, but by Homebrew.
If you're trying to use rbenv, maybe run brew uninstall ruby and/or check the output of echo $PATH to make sure that ~/.rbenv/shims is at the start.

unable to load gem cocoa pods while creating repo

rubygems/dependency.rb:296:in `to_specs': Could not find 'cocoapods' (>= 0) among 35 total gem(s) (Gem::LoadError)
from /Users/divyam.shukla/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /Users/user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /Users/user/.rvm/gems/ruby-2.0.0-p247/bin/pod:22:in `<main>'
I am getting this error.
Hey I had the same problem that you have, I solve it following the next steps:
(I strongly recommend to use rvm to manage ruby versions)
Remove cocoapods using gem uninstall cocoapods
Install rvm, to do this I followed this steps
https://rvm.io/rvm/install
After that reinstall cocoapods using gem install cocoapods
run pod setup
And after that everything works like a charm!.
You could notice that I didn't use sudo.
Hope it could helps you.
EDIT: If you have a slow internet connection it could take several minutes, to check the progress or steps use pod setup --verbose
I just ran this without doing any changes using rvm.
I do have rvm version: rvm 1.25.30 (stable).
Step 1: sudo gem uninstall cocoapods
Step 2: gem install cocoapods
Step 3: pod setup
Make sure not to install with sudo.
do this :
sudo gem install -n /usr/local/bin cocoapods

Can't install RubyZip gem on OS X Lion with RVM

TL;DR:
$ gem install rubyzip
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /Users/darth/.rvm/gems/ruby-1.9.2-p136/gems/rubyzip-0.9.4/README
And now in detail. I'm not sure which information is relevant, so I'm just gonna say it all.
I recently upgraded from OS X Snow Leopard to Lion (also upgraded Xcode to 4.2)
Everything worked just fine for a while
Today I decided to install some gems (RSpec, Cucumber), and I started getting date format warnings whenever I did anything with RubyGems
I decided to update RubyGems, from 1.3.6 (I'm not sure here) to current 1.8.11
The warning kept on popping up, so I tried to remove the gemset with rvm gemset empty, which also failed, because of some permission denied error (yes stupid me didn't write it down)
In result of that, I reinstalled Ruby via rvm remove 1.9.2 and rvm install 1.9.2 (I didn't forget to rvm use 1.9.2 --default after that.
I installed bundler gem install bundle and then tried to bundle install in my Rails 3.1.1 project, but it ends with error
Installing rubyzip (0.9.4)
Errno::EPERM: Operation not permitted - /Users/darth/.rvm/gems/ruby-1.9.2-p136/gems/rubyzip-0.9.4/README
An error occured while installing rubyzip (0.9.4), and Bundler cannot continue.
Make sure that `gem install rubyzip -v '0.9.4'` succeeds before bundling.
gem install rubyzip -v '0.9.4' gives the above mentioned error
The README file says to download source and install from there via ruby install.rb, which also ends in error
$ ruby install.rb
/Users/darth/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/fileutils.rb:841:in `install': wrong number of arguments (4 for 3) (ArgumentError)
from install.rb:21:in `block in <main>'
from install.rb:18:in `each'
from install.rb:18:in `<main>'
Even executing tests fro rubyzip ends up in bunch of errors
$ rake test
rake/gempackagetask is deprecated. Use rubygems/package_task instead
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
/Users/darth/.rvm/rubies/ruby-1.9.2-p136/bin/ruby -C test alltests.rb
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- stdrubyexttest (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from alltests.rb:5:in `<main>'
rake aborted!
Command failed with status (1): [/Users/darth/.rvm/rubies/ruby-1.9.2-p136/b...]
Tasks: TOP => test
(See full trace by running task with --trace)
I'm out of ideas, what can I do?
I'm really not sure what caused this, but I managed to fix it by doing the following.
Since reinstalling Ruby 1.9.2 didn't help, I decided to be even more drastical and went down to rvm. I found out that I had version 1.1.something installed, which is about 9 months old.
I tried to update, but it didn't help, so rvm implode did the trick. I even had to sudo rm -rf ~/.rvm, probably because I managed to mess up some gem installs by adding sudo to them.
After reinstalling rvm and reinstalling 1.9.2, it seems like everything is working fine now, even with Xcode 4.2.
Lesson learned, rm -rf & reinstall is better than trying to upgrade from a year old version :)

Resources