I installed the Ruby EE as my system-wide Ruby.
I added:
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
at the end of /etc/profile.
if [ -s "/usr/local/rvm/scripts/rvm" ] ; then
. "/usr/local/rvm/scripts/rvm"
fi
then
rvm install ree
rvm --default ree
I did my logoff and login, and I'm able to check ruby -v, and it's right, ree is my default Ruby.
The problem is, I install my gems, e.g gem install bundle, and then try to run bundler and it is not found. If I run the command one more time, rvm use ree, then I'm able to run bundler.
My RVM info:
web:~# rvm info
system:
system:
uname: "Linux web 2.6.18-238.9.1.el5.028stab089.1 #1 SMP Thu Apr 14 14:06:01 MSD 2011 x86_64 GNU/Linux"
bash: "/bin/bash => GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.6.5 by Wayne E. Seguin (wayneeseguin#gmail.com)[https://rvm.beginrescueend.com/]"
homes:
gem: "not set"
ruby: "not set"
binaries:
ruby: "/usr/local/rvm/bin/ruby"
irb: "/usr/local/rvm/bin/irb"
gem: "/usr/local/rvm/bin/gem"
rake: "/usr/local/rvm/bin/rake"
environment:
PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/rvm/bin:/usr/local/rvm/bin"
GEM_HOME: ""
GEM_PATH: ""
MY_RUBY_HOME: ""
IRBRC: ""
RUBYOPT: ""
gemset: ""
added extra infos
web:~# rvm list
rvm rubies
ree-1.8.7-2011.03 [ x86_64 ]
web:~# id
uid=0(root) gid=0(root) groups=0(root)
web:~# gem list | grep bundle
bundler (1.0.12)
web:~# gem list | grep bundler
bundler (1.0.12)
web:~# bundle
-bash: bundle: command not found
web:~# ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2011.03
web:~#
cause: i had in two different init scripts the source "/usr/local/rvm/scripts/rvm"
this answer helped me to find my way Why doesn't "RVM --default" work for me on MacOSX?
Related
I did this a few days ago:
$ rvm --default use 2.1.5
but then when I ran ruby -v today I got:
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
Is there a better way to permanently set the version of Ruby I use?
==== UPDATE
$ rvm use
Using /Users/snowcrash/.rvm/gems/ruby-2.1.5
$ which rvm
/Users/snowcrash/.rvm/bin/rvm
$ which ruby
/Users/snowcrash/.rvm/rubies/ruby-2.1.5/bin/ruby
and output of rvm info (note that ruby has reverted back to 2.0.0p481):
$ ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
$ rvm info
ruby-2.1.5:
system:
uname: "Darwin w.local 14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64"
system: "osx/10.10/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.53(1)-release (x86_64-apple-darwin14)"
zsh: "/bin/zsh => zsh 5.0.5 (x86_64-apple-darwin14.0)"
rvm:
version: "rvm 1.26.9 (latest) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "8 days 7 hours 2 minutes 42 seconds ago"
path: "/Users/snowcrash/.rvm"
ruby:
interpreter: "ruby"
version: "2.0.0p481"
date: "2014-05-08"
platform: "universal.x86_64-darwin14"
patchlevel: "2014-05-08 revision 45883"
full_version: "ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]"
homes:
gem: "/Users/snowcrash/.rvm/gems/ruby-2.1.5"
ruby: "/Users/snowcrash/.rvm/rubies/ruby-2.1.5"
binaries:
ruby: "/usr/bin/ruby"
irb: "/usr/bin/irb"
gem: "/usr/bin/gem"
rake: "/Users/snowcrash/.rvm/gems/ruby-2.1.5/bin/rake"
environment:
PATH: "/Users/snowcrash/.rvm/gems/ruby-2.1.5/bin:/Users/snowcrash/.apportable/SDK/bin:/Library/Frameworks/Python.framework/Versions/2.6/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/Users/snowcrash/Library/ec2-api-tools-1.3-24159/bin:/Users/snowcrash/bin:/Users/snowcrash/Library/android-sdk-mac_86:/Users/snowcrash/Library/android-sdk-mac_86/platform-tools:/Users/snowcrash/Library/bin:/usr/local/mysql/bin:/usr/local/bin:/Library/PostgreSQL/9.1/bin:/usr/local/sbin:/Users/snowcrash/.rvm/gems/ruby-2.1.5/bin:/Users/snowcrash/.rvm/gems/ruby-2.1.5#global/bin:/Users/snowcrash/.rvm/rubies/ruby-2.1.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/snowcrash/.rvm/bin:/Users/snowcrash/bin/gsutil:/usr/local/graphviz-2.14/bin:/Users/snowcrash/.rvm/bin"
GEM_HOME: "/Users/snowcrash/.rvm/gems/ruby-2.1.5"
GEM_PATH: "/Users/snowcrash/.rvm/gems/ruby-2.1.5:/Users/snowcrash/.rvm/gems/ruby-2.1.5#global"
MY_RUBY_HOME: "/Users/snowcrash/.rvm/rubies/ruby-2.1.5"
IRBRC: "/Users/snowcrash/.rvm/rubies/ruby-2.1.5/.irbrc"
RUBYOPT: ""
gemset: ""
Your PATH contains /usr/bin multiple times, the first of which is before /Users/snowcrash/.rvm/rubies/ruby-2.1.5/bin, so the system provided ruby is added first.
You seem to have a lot of entries in there - review your shells initialisation files (.bashrc, .bash_profile etc) and check anything that manipulates $PATH
What does stuff like rvm use, which rvm or which ruby say? That looks like the system Ruby, which to me means you don't have rvm properly installed and you opened a new terminal session and got the system version.
Or, the command was entered wrong. rvm use --default 2.1.5
After that, rvm list will show it marked as default.
(nick#blerp)-(~)
(507)⚡️ rvm use --default 2.2.0
Using /Users/nick/.rvm/gems/ruby-2.2.0
(nick#blerp)-(~)
(508)⚡️ rvm list
rvm rubies
=* ruby-2.2.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
You could always reinstall rvm (doesn't hurt to reinstall on top) and make sure the path settings are in your shell dotfiles.
Jenkins is running on an ubuntu machine. It has a special user jenkins which is used for executing the jobs.
RVM is installed and in an ssh shell on the server, logged in as the jenkins user, everything works fine.(If I set RVM to use ruby 1.9.3 ruby -vreturns 1.9.3 as version)
I use the RVM-plugin for Jenkins and have set it to use 1.9.3
Output by Jenkins for RVM:
Capturing environment variables produced by 'rvm use 1.9.3'
$ bash -c export
$ bash -c "test -f ~/.rvm/scripts/rvm"
$ bash -c "test -f /usr/local/rvm/scripts/rvm"
[workspace] $ bash -c " source /usr/local/rvm/scripts/rvm && rvm use --install --create 1.9.3 && export > rvm.env"
Using /usr/local/rvm/gems/ruby-1.9.3-p0
However if I later want to execute my script it uses ruby version 1.8.7.
Output for ruby version and environment:
+ which ruby
/usr/bin/ruby
+ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
+ rvm info
ruby-1.9.3-p0:
system:
uname: "Linux h1332957.stratoserver.net 2.6.32-042stab078.27 #1 SMP Mon Jul 1 20:48:07 MSK 2013 i686 GNU/Linux"
bash: "/bin/bash => GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.9.2 by Wayne E. Seguin (wayneeseguin#gmail.com [https://rvm.beginrescueend.com/]"
ruby:
interpreter: "ruby"
version: "1.8.7"
date: "2010-01-10"
platform: "i486-linux"
patchlevel: "2010-01-10 patchlevel 249"
full_version: "ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]"
homes:
gem: "/usr/local/rvm/gems/ruby-1.9.3-p0"
ruby: "/usr/local/rvm/rubies/ruby-1.9.3-p0"
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/local/games:/usr/games:/usr/local/rvm/bin:/usr/local/rvm/bin"
GEM_HOME: "/usr/local/rvm/gems/ruby-1.9.3-p0"
GEM_PATH: "/usr/local/rvm/gems/ruby-1.9.3-p0:/usr/local/rvm/gems/ruby-1.9.3-p0#global"
MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-1.9.3-p0"
IRBRC: "/usr/local/rvm/rubies/ruby-1.9.3-p0/.irbrc"
RUBYOPT: ""
gemset: ""
Question:
How can I make Jenkins use ruby version 1.9.3 instead?
I solved the problem by sourcing rvm.
I updated my script to look like this:
#!/bin/bash
source "/usr/local/rvm/scripts/rvm"
rvm use 1.9.3
rvm info
Now the output by rvm info is correct.
Most important are the first and second line.
Output by rvm info:
ruby-1.9.3-p0:
system:
uname: "Linux h1332957.stratoserver.net 2.6.32-042stab078.27 #1 SMP Mon Jul 1 20:48:07 MSK 2013 i686 GNU/Linux"
bash: "/bin/bash => GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.9.2 by Wayne E. Seguin (wayneeseguin#gmail.com) [https://rvm.beginrescueend.com/]"
ruby:
interpreter: "ruby"
version: "1.9.3p0"
date: "2011-10-30"
platform: "i686-linux"
patchlevel: "2011-10-30 revision 33570"
full_version: "ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]"
homes:
gem: "/usr/local/rvm/gems/ruby-1.9.3-p0"
ruby: "/usr/local/rvm/rubies/ruby-1.9.3-p0"
binaries:
ruby: "/usr/local/rvm/rubies/ruby-1.9.3-p0/bin/ruby"
irb: "/usr/local/rvm/rubies/ruby-1.9.3-p0/bin/irb"
gem: "/usr/local/rvm/rubies/ruby-1.9.3-p0/bin/gem"
rake: "/usr/local/rvm/gems/ruby-1.9.3-p0/bin/rake"
environment:
PATH: "/usr/local/rvm/gems/ruby-1.9.3-p0/bin:/usr/local/rvm/gems/ruby-1.9.3-p0#global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p0/bin:/usr/local/rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
GEM_HOME: "/usr/local/rvm/gems/ruby-1.9.3-p0"
GEM_PATH: "/usr/local/rvm/gems/ruby-1.9.3-p0:/usr/local/rvm/gems/ruby-1.9.3-p0#global"
MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-1.9.3-p0"
IRBRC: "/usr/local/rvm/rubies/ruby-1.9.3-p0/.irbrc"
RUBYOPT: ""
gemset: ""
Rvm creates a environment file on your workspace called "rvm.env". If you add:
source rvm.env
to all your shell scripts, you'll get the right environment without having to set up rvm manually.
Adding "rvm use x.x.x" didn't work for me. But it did produce a helpful error message:
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use /bin/bash --login as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for an example.
My terminal emulator was already allowing login shell too.
Adding "--login" to the bash call got it to work.
After installing rvm and modifying my .zshrc file when running rvm info i get a different version that when i type ruby -v and when trying to install a gem i get a bunch of errors relating to the system ruby
rvm info output:
$ rvm info
ruby-2.1.1:
system:
uname: "Darwin Joshs-MacBook-Pro.local 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64"
system: "osx/10.9/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13)"
zsh: "/bin/zsh => zsh 5.0.2 (x86_64-apple-darwin13.0)"
rvm:
version: "rvm 1.25.20 (stable) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "3 hours 4 minutes 13 seconds ago"
path: "/Users/joshburns/.rvm"
ruby:
interpreter: "ruby"
version: "2.0.0p247"
date: "2013-06-27"
platform: "universal.x86_64-darwin13"
patchlevel: "2013-06-27 revision 41674"
full_version: "ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]"
homes:
ZSH=$HOME/.oh-my-zsh
gem: "/Users/joshburns/.rvm/gems/ruby-2.1.1"
ruby: "/Users/joshburns/.rvm/rubies/ruby-2.1.1"
binaries:
ruby: "/usr/bin/ruby"
irb: "/usr/bin/irb"
gem: "/usr/bin/gem"
rake: "/Users/joshburns/.rvm/gems/ruby-2.1.1/bin/rake"
environment:
PATH: "/Users/joshburns/.rvm/gems/ruby-2.1.1/bin:/Users/joshburns/.rvm/gems/ruby-2.1.1#global/bin:/Users/joshburns/.rvm/rubies/ruby-2.1.1/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/joshburns/bin:/Users/joshburns/.rvm/bin"
GEM_HOME: "/Users/joshburns/.rvm/gems/ruby-2.1.1"
GEM_PATH: "/Users/joshburns/.rvm/gems/ruby-2.1.1:/Users/joshburns/.rvm/gems/ruby-2.1.1#global"
MY_RUBY_HOME: "/Users/joshburns/.rvm/rubies/ruby-2.1.1"
IRBRC: "/Users/joshburns/.rvm/rubies/ruby-2.1.1/.irbrc"
RUBYOPT: ""
gemset: ""
ruby -v output:
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
I think I have had a similar problem but found the solution here:
http://www.intelligentbee.com/blog/2013/09/17/setup-a-simple-ruby-2-on-rails-4-environment-with-vagrant-and-virtual-box/
Look for the bit:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
rvm use ruby-2.0.0-p247 (replace with your ruby version)
I'm trying to install Ruby 2.0 on my Debian server and decided to do this via RVM. I downloaded it using:
~$ \curl -L https://get.rvm.io | bash -s stable
But when I try to install Ruby, it looks like RVM is trying to install Rubygems instead.
~$ rvm install 2.0.0
=> 'ruby' was not found, cannot install rubygems unless ruby is present (Do you have an RVM ruby installed & selected?)
I've checked the RVM documentation and rvm install <ruby version> is definitely the command for installing Ruby, not Rubygems. So why is the issue above occuring? Thank you!
EDIT:
Output of 'rvm info':
[name]#debian-server:~/.rvm/rubies$ rvm info
system:
uname: "Linux debian-server 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2+deb7u2 x86_64 GNU/Linux"
system: "debian/7/x86_64"
bash: "/bin/bash => GNU bash, version 4.2.37(1)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.24.5 (stable) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "33 minutes 56 seconds ago"
path: "/home/[name]/.rvm"
homes:
gem: "not set"
ruby: "not set"
binaries:
ruby: ""
irb: ""
gem: ""
rake: "/home/[name]/.rvm/bin/rake"
environment:
PATH: "/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/[name]/.rvm/bin"
GEM_HOME: ""
GEM_PATH: ""
MY_RUBY_HOME: ""
IRBRC: ""
RUBYOPT: ""
gemset: ""
Output of 'rvm requirements':
~$ rvm requirements
Checking requirements for debian. Requirements installation successful.
I'm not sure I understand how you arrived at this situation, but if you want ruby 2.0 installed via RVM, then I would suggest the following:
rvm implode
\curl -L https://get.rvm.io | bash -s stable --ruby
Then make sure you source ~/.bash_profile (as mentioned in the installation output) to load RVM in each new shell.
I dont understand why after the rvm command I am still on ruby 1.8.7. Ive followed the install instructions for rvm and it all seemed to go fine - where do I look to start resolving this?
andrew#unifex:~$ rvm use 1.9.2 --default
Using /home/andrew/.rvm/gems/ruby-1.9.2-p290
andrew#unifex:~$ ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
andrew#unifex:~$
andrew#unifex:~$ rvm info
ruby-1.9.2-p290:
system:
uname: "Linux unifex 2.6.22-3-amd64 #1 SMP Sun Nov 4 18:18:09 UTC 2007 x86_64 GNU/Linux"
bash: "/bin/bash => GNU bash, version 3.1.17(1)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.9.2 by Wayne E. Seguin (wayneeseguin#gmail.com) [https://rvm.beginrescueend.com/]"
ruby:
interpreter: "ruby"
version: "1.9.2p290"
date: "2011-07-09"
platform: "x86_64-linux"
patchlevel: "2011-07-09 revision 32553"
full_version: "ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]"
homes:
gem: "/home/andrew/.rvm/gems/ruby-1.9.2-p290"
ruby: "/home/andrew/.rvm/rubies/ruby-1.9.2-p290"
binaries:
ruby: "/home/andrew/.rvm/rubies/ruby-1.9.2-p290/bin/ruby"
irb: "/home/andrew/.rvm/rubies/ruby-1.9.2-p290/bin/irb"
gem: "/home/andrew/.rvm/rubies/ruby-1.9.2-p290/bin/gem"
rake: "/home/andrew/.rvm/gems/ruby-1.9.2-p290/bin/rake"
environment:
PATH: "/home/andrew/.rvm/gems/ruby-1.9.2-p290/bin:/home/andrew/.rvm/gems/ruby-1.9.2-p290#global/bin:/home/andrew/.rvm/rubies/ruby-1.9.2-p290/bin:/home/andrew/.rvm/bin:/usr/local/java/jdk1.6.0_20/bin:/usr/local/apache/maven/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/local/java/jdk1.6.0_03/bin"
GEM_HOME: "/home/andrew/.rvm/gems/ruby-1.9.2-p290"
GEM_PATH: "/home/andrew/.rvm/gems/ruby-1.9.2-p290:/home/andrew/.rvm/gems/ruby-1.9.2-p290#global"
MY_RUBY_HOME: "/home/andrew/.rvm/rubies/ruby-1.9.2-p290"
IRBRC: "/home/andrew/.rvm/rubies/ruby-1.9.2-p290/.irbrc"
RUBYOPT: ""
gemset: ""
I had this exact problem. It's down to your $PATH not being correct - /usr/bin/ruby is found before rvm gets a chance to do its thing.
In your ~/.bash_profile (As in /Users/andrew/.bash_profile) ensure you have this line present at the bottom of the file:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Then open a new shell
rvm reload
rvm use 1.9.2 --default
ruby -v
You should now have the correct version displayed.