Need to remove ruby to install cocoapods - ruby

I'm trying to install cocaopods on my Mac Yosemite system. However, when I type in this command:
$ sudo gem install cocoapods
It returns this error:
ERROR: Error installing cocoapods:
i18n requires Ruby version >= 1.9.3.
Typing which ruby, returns:
/Users/myname/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
typing rvm rubies gives this message:
rvm rubies
ruby-1.8.7-p334 [ x86_64 ]
=> ruby-1.9.2-p180 [ x86_64 ]
However, typing /usr/bin/ruby --version gives this message:
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
I'm thinking if I can uninstall the ruby that's in my home directory, the cocoapods install will find the more recent ruby version. However, I'm not not sure exactly how to do that and/or what impact it would have. Any suggestions?

Looks like you have rvm installed when you don't want to. You can remove it entirely with rvm implode. Then when you open a new shell which -a ruby should just show /usr/bin/ruby

Related

RVM ruby version 2.2.1, Actual ruby version 1.8.7

I am trying to install Jekyll in a VM for my web course and it required ruby >= 2.0.0.
I've gone through installing RVM and using this to install the desired version of ruby, but I then get the following:
vagrant#precise32:~/.rvm/bin$ bash rvm list
rvm rubies
ruby-2.1.1 [ i686 ]
=* ruby-2.2.1 [ i686 ]
 # => - current
 # =* - current && default
 # * - default
vagrant#precise32:~/.rvm/bin$ ruby -v
ruby 1.8.7 (2011-06-30
patchlevel 352) [i686-linux]
vagrant#precise32:~/.rvm/bin$ sudo gem
install jekyll ERROR: Error installing jekyll:jekyll requires Ruby version >= 2.0.0.
vagrant#precise32:~/.rvm/bin
I don't understand why it still thinks it is using version 1.8.7, as it confirms that it has installed 2.2.1.
I have done the following:
Use sudo chown to change ownership of the .gnupg folder recursively to vagrant (my system user) as defined here.
Install RVM following the instructions here.
Installed the version (2.2.1) of ruby using these instructions (https://rvm.io/rubies/installing).
Tried to install Jekyll using sudo gem install jekyll, but I get an error saying that I need ruby version 2.0 or higher.
I'm not a developer, this is an introductory web development course. Also please excuse the corrupt link, I can't post more than 2.
Update: I think I might need to do something as described here: How do I change my Ruby version using RVM?.
Also - although I installed RVM, I originally installed it using sudo apt-get which corrupted it. I uninstalled that, and ran the most recent install with curl. To use it I have to navigate to the directory and use "bash rvm list"
Add following two lines:
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*
to your $HOME/.profile file and restart a shell.
It seems your machine is using Its own instead by RVM.
1: rvm list # Listing install rubies will you get versions of ruby which is installed by RVM
2: rvm use < ruby-version > # for instances ruby-1.9.3-p125
3: bundle install
4: Tried to install Jekyll using sudo gem install jekyll, but I get an
error saying that I need ruby version 2.0 or higher.
For that you could try Installing Jekyll on Ubuntu 14.04
Hope this help you !!!

Installed Ruby 2.0.0, but an error tells me I have 1.9.3 installed

I just cloned my Rails app onto my new computer. Ruby 2.0.0 seemed to install with no issue, but when I run sudo bundle install inside my app, I get an error telling me I have Ruby 1.9.3 installed:
$ sudo bundle install
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
and bundle install returns this:
$ bundle install
/home/user/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler (LoadError)
from /home/user/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/bin/bundle:7:in `<main>'
I don't understand why I would have 1.9.3 installed. I used the command rvm install 2.0.0 to install Ruby.
Also, ruby -v returns:
ruby 2.0.0p643 (2015-02-25 revision 49749) [x86_64-linux]
What's going on?
Output of rvm list
$ rvm list
rvm rubies
=* ruby-2.0.0-p643 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Because you're using rvm, you shouldn't ever need to use sudo on any of your commands. Using sudo is likely running the globally installed 1.9.3 version.
If you just installed Ruby 2.0.0 and haven't done anything else, then you most likely need to install bundler first before using it:
gem install bundler
Once you've done that, bundle install (without sudo) should work fine.

RVM and Ruby version not working as expected

I want to install the compass html5 boilerplate gem. When I try to install it I get the following error.
$ sudo gem install html5-boilerplate
ERROR: Error installing html5-boilerplate:
compass-h5bp requires Ruby version ~> 2.0.
Then when I check my ruby version it says:
$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
But I used RVM before so I thought I could just change version but when I check it says I'm using ruby-2.2.0 already.
$ rvm list
rvm rubies
=* ruby-2.2.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
I think I must be missing something obhvious, it's been a while since I've worked with Ruby and RVM.
Update 1
I ran the below commands as suggested by #tadman and it does seem the wrong path is being used.
~:$ cd ~/.rvm/bin
bin:$ ls
ruby-rvm-env rvm rvm-auto-ruby rvm-exec rvm-prompt rvm-shebang-ruby rvm-shell rvm-smile rvmsudo
bin:$ which ruby
/usr/bin/ruby
UPDATE 2
After correcting the path in my .bash_profile the ruby version seems correct but I'm still getting the same error when trying to install the html5-boilerplate gem??
$ sudo gem install html5-boilerplate
ERROR: Error installing html5-boilerplate:
compass-h5bp requires Ruby version ~> 2.0.
$ ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
$ rvm list
rvm rubies
=* ruby-2.2.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
$ compass -v
Compass 1.0.3 (Polaris)
Copyright (c) 2008-2015 Chris Eppstein
Released under the MIT License.
Compass is charityware.
Please make a tax deductable donation for a worthy cause: http://umdf.org/compass
Also i have the compass gem installed on both Ruby 1.9.1 and RVM's ruby 2.2.0. Could this have something to do with it?
$ pwd
/var/lib/gems/1.9.1/gems/compass-1.0.3
$ cd /home/ross/.rvm/gems/ruby-2.2.0/gems/compass-1.0.3
$ pwd
/home/ross/.rvm/gems/ruby-2.2.0/gems/compass-1.0.3
Is there a way to check which ruby version compass is using?
Having RVM and having RVM installed correctly are two different things. The most common cause of a mismatch like this is that your system Ruby has priority in your PATH.
In a POSIX shell, which ruby will tell you which one is getting executed. It is probably the wrong one.
RVM does its magic by manipulating which Ruby shows up in the RVM bin path, often ~/.rvm/bin or something similar. To get it to work correctly you'll need to ensure that path is first in your $PATH.
You may want to try reinstalling the RVM stub, or check that it's correctly loaded into your environment.

Can't install jekyll gem at linux (classifier-reborn ruby version error)

I'm working on ElementaryOS (linux) and this is what I have:
ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
rvm list
rvm rubies
ruby-1.9.3-p551 [ x86_64 ]
=> ruby-2.2.0 [ x86_64 ]
which ruby
/home/ofcapl/.rvm/rubies/ruby-2.2.0/bin/ruby
And when I try to install jekyll gem I've got an error:
ERROR: Error installing jekyll:
classifier-reborn requires Ruby version >= 1.9.3.
I've tried to install it on ruby 2.2.0 and 1.9.3 but with no success.. Anyone know what to do?
I've found solution here
I've reinstalled rvm and rubygems without sudo and then installed jekyll gem without sudo.

better_errors requires Ruby version >= 2.0.0

Bundle fails to install better_errors.
Gem::InstallError: better_errors requires Ruby version >= 2.0.0.
An error occurred while installing better_errors (2.0.0), and Bundler cannot continue.
Make sure that `gem install better_errors -v '2.0.0'` succeeds before bundling.
But gem install better_errors works fine.
ruby --version says ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux-gnu]. I already tried upgrading to 2.1 but still not working.
Any suggestions?
I had this same problem. In my case, the bundler script had
#!/usr/bin/ruby
as the initial line in the script. As a result, it was calling the system (non-rbenv) version, which was 1.9.1 (in Linux Mint)
It's pretty hacky but changing that first line by running
sudo nano /usr/local/bin/bundle
to the full path for the rbenv shim (in my case):
#!/home/$YOUR_USERNAME/.rbenv/shims/ruby
solved the problem.
Hi for all the people who have different versions of ruby in their machine, and even if
rvm use ruby-version doesn't work.
Try this,
rvm list this will specify all the ruby version in your machine.
rvm rubies
* ruby-1.9.3-p484 [ x86_64 ]
ruby-2.1.0-preview2 [ x86_64 ]
ruby-2.1.1 [ x86_64 ]
=> ruby-2.1.5 [ x86_64 ]
In your project root folder, just create a file
.ruby-version
and add the ruby version you are planning to use.
ruby-2.1.5
Thats it, restart your application and try reinstalling your gems. :)
If you use rvm, make sure you don't have an .rvmrc file at the root of your project that force ruby < 2.0 to run, same with rbenv and .ruby-version file

Resources