"ruby -v" no longer returning current version - ruby

In the process of trying to upgrade to Ruby 1.9.3, I think I broke something. I believe I have Ruby 1.9.3 successfully installed. However, now when I type ruby -v into terminal, I'm not getting any messages. Here's the sample output:
rish-macbookair:~ rish$ ruby -v
rish-macbookair:~ rish$
One of the last things I did was install the "Command Line Tools" in XCode because I was getting a "missing libraries" error.
Any ideas on what might have happened, or where to start?
Edit: upon trying to reinstall 1.9.3, I get this:
rish-macbookair:~ rish$ rvm reinstall 1.9.3
/usr/local/rvm/src/ruby-1.9.3-p327 has already been removed.
Removing /usr/local/rvm/rubies/ruby-1.9.3-p327...
https://rvm.io/binaries/osx/10.8/x86_64/ruby-1.9.3-p327.tar.bz2 - #configure
ruby-1.9.3-p327 - #download
ruby-1.9.3-p327 - #extract
ruby-1.9.3-p327 - #validate
ruby-1.9.3-p327 - #setup
sed: RE error: illegal byte sequence
Saving wrappers to '/usr/local/rvm/bin'.
ruby-1.9.3-p327 - #importing default gemsets (/usr/local/rvm/gemsets/), this may take time ...
Making gemset ruby-1.9.3-p327 pristine.
Making gemset ruby-1.9.3-p327#global pristine.
rish-macbookair:~ rish$
I have tried reinstalling RVM as well, but I'm back in the same place

you are using old version of rvm, try:
rvm get head
rvm reinstall 1.9.3
rvm use 1.9.3

Related

Ruby version and rvm out of sync, Ruby interpreter version not changing

Because of a legacy system, I need to use Ruby v1.8.7-p374. I've been using RVM to use that version of Ruby and all seemed to work well, until something changed.
Now my system will not use the Ruby version that I'm specifying with RVM. Is there a way to switch between the Ruby versions manually?
Related question: "Can't change Ruby Version using RVM"
Here are some relevant pieces of information:
$ rvm --default use ruby-1.8.7-p374
Using /Users/wroberts/.rvm/gems/ruby-1.8.7-p374
$ ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]
$ echo $PATH
/Users/wroberts/.rvm/gems/ruby-1.8.7-p374/bin:/Users/wroberts/.rvm/gems/ruby-1.8.7-p374#global/bin:/Users/wroberts/.rvm/rubies/ruby-1.8.7-p374/bin:/Users/wroberts/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/ant/bin:/usr/local/mysql/bin:/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/bin:/usr/local/apache-maven/apache-maven-3.2.3/bin:/usr/bin/chromedriver/bin:/Users/wroberts/dev/tools/flex:/usr/local/bin:/usr/bin:/usr/sbin
$ rvm list
rvm rubies
ruby-1.8.7-head [ i686 ]
=* ruby-1.8.7-p374 [ i686 ]
# => - current
# =* - current && default
# * - default
$ which ruby
/Users/wroberts/.rvm/gems/ruby-1.8.7-p374/bin/ruby
$ ls /Users/wroberts/.rvm/gems/ruby-1.8.7-p374/bin/ruby
/Users/wroberts/.rvm/gems/ruby-1.8.7-p374/bin/ruby
$ rvm info
RVM version 1.26.4 (master) is installed yet 1.26.4 (latest) is loaded.
Please do one of the following:
* 'rvm reload'
* open a new shell
* 'echo rvm_auto_reload_flag=1 >> ~/.rvmrc' # for auto reload with msg.
* 'echo rvm_auto_reload_flag=2 >> ~/.rvmrc' # for silent auto reload.
Even more issues now:
$ rvm install 1.8.7 --without-tcl --without-tk
Warning! PATH is not properly set up, '/Users/wroberts/.rvm/gems/ruby-1.8.7-p374/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-1.8.7-p374'.
Warning! Requested ruby installation which requires another ruby available - installing ruby-1.8.7-p374 first.
Checking requirements for osx.
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions
/Current/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 28: /usr/local/Library/brew.rb: Undefined error: 0
ERROR: '/bin' is not writable - it is required for Homebrew, try 'brew doctor' to fix it!
Requirements installation failed with status: 1.
To proceed rvm requires a ruby-1.8.7-p374 compatible ruby is installed.
We attempted to install it automatically but it failed with status 1.
Please install it manually (or a compatible alternative) to proceed.
IT IS WORKING -- my workaround, and one more question
so I did the rvm implode, which (I think) resulted in ruby not being in the System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby.
So everytime I tried to install 1.8.7 --without-tcl --without-tk something was wrong with my brew file.
A FEW FINAL QUESTIONS:
I checked the brew file and at the top it was using
#!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby -W0
and I changed it to
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -W0
and now brew worked, I was able to install 1.8.7 and do rvm --default use ruby-1.8.7-p374 and my gems install etc.
First question, is this hacky solution a major issue for me, not a big deal, or unknown territory due to sheer stupidity of the problem?
Second question, everytime I open a new bash shell ruby -v gives me the (I believe) system version of ruby:
$ ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]
$ which ruby
/usr/bin/ruby
but then I set the default rvm and would like this to happen automatically,
$ rvm --default use ruby-1.8.7-p374
Warning! PATH is not properly set up, '/Users/wroberts/.rvm/gems/ruby-1.8.7-p374/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-1.8.7-p374'.
Using /Users/wroberts/.rvm/gems/ruby-1.8.7-p374
$ ruby -v
ruby 1.8.7 (2013-06-27 patchlevel 374) [i686-darwin13.4.
$ which ruby
/Users/wroberts/.rvm/rubies/ruby-1.8.7-p374/bin/ruby
It says my path is not properly set up, but if you check the top of this post, /Users/wroberts/.rvm/gems/ruby-1.8.7-p374/bin IS at the first place, how can this be fixed?
RVM is telling you that it doesn't like the configuration of your shell. So try running
rvm get stable --auto-dotfiles
as it suggests. RVM needs to be the last thing included in your shell config otherwise its functionality can be affected by shell commands loaded after it.
If you are using homebrew, I'd do an update and doctor.
Do:
rvm implode
install rvm
again. This should fix the issue.

Fresh Installs of RVM and Ruby 2.1.1 - dyld library/pathing error

I have been trying to install RVM and Ruby 2.1.1 onto my new Mac (OS 10.9.2), and everything seems to be going well until I try to install any version of Ruby.
My input
$ rvm reinstall 2.1
So far so good...
ruby-2.1.1 - #removing rubies/ruby-2.1.1..
Searching for binary rubies, this might take some time.
Found remote file https://rvm.io/binaries/osx/10.9/x86_64/ruby-2.1.1.tar.bz2
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' already are up to date.
Requirements installation successful.
ruby-2.1.1 - #configure
ruby-2.1.1 - #download
ruby-2.1.1 - #validate archive
ruby-2.1.1 - #extract
ruby-2.1.1 - #validate binary
ruby-2.1.1 - #setup
ruby-2.1.1 - #making binaries executable..
ruby-2.1.1 - #downloading rubygems-2.2.2
ruby-2.1.1 - #extracting rubygems-2.2.2....
ruby-2.1.1 - #removing old rubygems.........
But then...
ruby-2.1.1 - #installing rubygems-2.2.2.
Error running 'env GEM_HOME= GEM_PATH= /Users/dylanoshea/.rvm/rubies/ruby-2.1.1/bin/ruby -d /Users/dylanoshea/.rvm/src/rubygems-2.2.2/setup.rb --verbose',
showing last 15 lines of /Users/dylanoshea/.rvm/log/1395654507_ruby-2.1.1/rubygems.install.log
[2014-03-24 02:48:47] /Users/dylanoshea/.rvm/rubies/ruby-2.1.1/bin/ruby
current path: /Users/dylanoshea/.rvm/src/rubygems-2.2.2
PATH=/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/dylanoshea/.rvm/bin
command(7): env GEM_HOME= GEM_PATH= /Users/dylanoshea/.rvm/rubies/ruby-2.1.1/bin/ruby -d /Users/dylanoshea/.rvm/src/rubygems-2.2.2/setup.rb --verbose
dyld: Library not loaded: /Users/mpapis/.sm/pkg/versions/openssl/1.0.1f/lib/libssl.1.0.0.dylib
Referenced from: /Users/dylanoshea/.rvm/rubies/ruby-2.1.1/bin/ruby
Reason: image not found
/Users/dylanoshea/.rvm/scripts/functions/support: line 411: 14265 Trace/BPT trap: 5 "$ruby_path" -rrbconfig -e '\
File.open("'"$config_path"'","w") { |file|
RbConfig::CONFIG.sort.each{|key,value|
file.write("#{key.gsub(/\.|-/,"_")}=\"#{value.gsub("$","\\$")}\"\n")
}
}
' > /dev/null 2>&1
dyld: Library not loaded: /Users/mpapis/.sm/pkg/versions/openssl/1.0.1f/lib/libssl.1.0.0.dylib
Referenced from: /Users/dylanoshea/.rvm/rubies/ruby-2.1.1/bin/ruby
Reason: image not found
Empty path passed to certificates update, functions stack: requirements_osx_update_openssl_cert_run rvm_requiremnts_fail_or_run_action __rvm_osx_ssl_certs_ensure_for_ruby __rvm_osx_ssl_certs_ensure_for_ruby_except_jruby external_import_setup external_import main
Gemset '' does not exist, 'rvm ruby-2.1.1 do rvm gemset create ' first, or append '--create'.
__rvm_rm_rf already gone: /Users/dylanoshea/.rvm/tmp/5021*
I have repeatedly tried deleting, imploding, removing and un/reinstalling all of my RVM components and Ruby versions, but it doesn't make a difference -- I still get this error. Curiously, the broken path refers to an "mpapis" who is one of the developers of RVM.
dyld: Library not loaded: /Users/mpapis/.sm/pkg/versions/openssl/1.0.1f/lib/libssl.1.0.0.dylib
Any help?
It looks it's a temporary bug: https://twitter.com/mpapis/status/447926386314186752.
The disable-binary option worked for me:
rvm reinstall 2.1.1 --disable-binary
EDIT - better solution
I see that some people still have this problem. Today much better solution is to update RVM like this:
rvm get stable
The problem was caused by RVM - it had some paths hard-coded into ruby binary versions. But this issue was already fixed and currently there's no need in compiling ruby locally. All you need is to get most recent RVM version.
as per https://github.com/wayneeseguin/rvm/issues/2732 :
rvm reinstall 2.1.1 --disable-binary
should allow you to install it.
also setting your "rvm use" to the most recent version of ruby on your "rvm list" also helped me.
and the issue is now closed on github, so in a couple of days (question : does anyone know the usual turn around for rvm patches?) the fix should be up on the rvm.io site and running "rvm get stable" will update your intallation with the patch

installing ruby 2.0.0 through RVM

I am on Macbook Air (v. 10.8.4) and am trying to install ruby 2.0.0. I did rvm get stable then rvm install ruby-2.0.0. I get this error...
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.0.0-p247, this may take a while depending on your cpu(s)...
ruby-2.0.0-p247 - #downloading ruby-2.0.0-p247, this may take a while depending on your connection...
ruby-2.0.0-p247 - #extracted to /usr/local/rvm/src/ruby-2.0.0-p247 (already extracted)
ruby-2.0.0-p247 - #configuring - using Zsh, can not show progress, be patient...
ruby-2.0.0-p247 - #compiling - using Zsh, can not show progress, be patient...
Error running 'make -j4',
please read /usr/local/rvm/log/ruby-2.0.0-p247/1373658495_make.log
There has been an error while running make. Halting the installation.
I tried Can't install Ruby 2.0.0-p0 with RVM. Error running 'make -j8' but I am still getting the same error. As in, I tried
I copied and pasted the log file into a google doc because it was 400+ lines. Link here https://docs.google.com/document/d/1mwiL88KbWYfFge3XKQF2hOJjG_8PzYTdcRFxbZcpUeU/edit?usp=sharing
try running these commands in given sequence: ---
brew update
brew tap homebrew/dupes
brew install apple-gcc42
rvm get stable
rvm install ruby-2.0.0

RVM not compiling ruby 1.9.3

I'm having an issue with RVM that I haven't seen before. I'm trying to install ruby 1.9.3 but it installs a binary version instead of compiling:
rvm install 1.9.3
Searching for binary rubies, this might take some time.
ruby-1.9.3-p362 - #configure
ruby-1.9.3-p362 - #download
ruby-1.9.3-p362 - #validate archive
tar: Record size = 8 blocks
tar: Record size = 8 blocks
ruby-1.9.3-p362 - #extract
ruby-1.9.3-p362 - #validate binary
ruby-1.9.3-p362 - #setup
Saving wrappers to '/home/vagrant/.rvm/bin'.
ruby-1.9.3-p362 - #importing default gemsets, this may take time ...
Then if I try
$ rvm use 1.9.3
$ ruby -v
$ ruby 1.9.3p362 (2012-12-25 revision 38607) [i686-linux]
However, there are no sources:
$ ls .rvm/src/
ruby-1.8.7-p371 rubygems-1.8.24 rvm yaml-0.1.4
Is there any reason why RVM is not compiling ruby 1.9.3?
Thanks for your help!
Compiling ruby takes time, RVM provides binary rubies so Ruby can be installed faster and that no compilations errors break installation.
You could check rvm help install where first line is:
Usage
rvm install {ruby-string} [--verify-download {0,1,2}] [--binary|--disable-binary|--movable]
so it's enough to use:
rvm reinstall 1.9.3 --disable-binary
but if you only need sources then run:
rvm fetch 1.9.3

Issue installing 1.8.7 p358 under RVM

After getting Xcode rvm install 1.9.3 works totally fine. However, rvm install 1.8.7 throws the following error.
~ ☺ rvm install 1.8.7
Installing Ruby from source to: /Users/jordanscales/.rvm/rubies/ruby-1.8.7-p358, this may take a while depending on your cpu(s)...
ruby-1.8.7-p358 - #fetching
ruby-1.8.7-p358 - #extracting ruby-1.8.7-p358 to /Users/jordanscales/.rvm/src/ruby-1.8.7-p358
Error running 'tar xjf /Users/jordanscales/.rvm/archives/ruby-1.8.7-p358.tar.bz2 -C /Users/jordanscales/.rvm/tmp/rvm_src_30581 ', please read /Users/jordanscales/.rvm/log/ruby-1.8.7-p358/extract.log
There has been an error while trying to extract the source.
Halting the installation.
There has been an error fetching the ruby interpreter. Halting the installation.
Please be aware that you just installed a ruby that requires 2 patches just to be compiled on up to date linux system.
This may have known and unaccounted for security vulnerabilities.
Please consider upgrading to Ruby 1.9.3-194 which will have all of the latest security patches.
~ ☺
The log reads
[2012-06-04 17:06:23] tar xjf /Users/jordanscales/.rvm/archives/ruby-1.8.7-p358.tar.bz2 -C /Users/jordanscales/.rvm/tmp/rvm_src_30581
ruby-1.8.7-p358/lib/test/unit/ui/gtk/testrunner.rb: (Empty error message)
tar: Error exit delayed from previous errors.
Any idea how to fix? I've tried rvm get head, installing gcc-4.2 and using that, using clang, etc. But nothing seems to work.
Make sure to satisfy all requirements specified by:
rvm requirements
Including Xcode 4.1 or osx-gcc-installer
Run (to fix broken download):
rvm cleanup archives
and try again:
rvm reinstall 1.8.7
Is there any reason why you are going with 1.8.7? it's about at end of life and 1.9.3 should be used instead if this is not an requirement.

Resources