RVM : Can't install Ruby 1.9.3-p551 (macOS) - ruby

My rvm version is 1.29.12 and macOS 11.2.3, here is the error messages.
Error running 'env GEM_HOME=/Users/yuanyuanliu/.rvm/gems/ruby-1.9.3-p551#global GEM_PATH= /Users/yuanyuanliu/.rvm/rubies/ruby-1.9.3-p551/bin/ruby -d /Users/yuanyuanliu/.rvm/src/rubygems-2.7.9/setup.rb --no-document',
please read /Users/yuanyuanliu/.rvm/log/1618286479_ruby-1.9.3-p551/rubygems.install.log
then cat rubygems.install.log
Exception `LoadError' at /Users/yuanyuanliu/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rubygems.rb:1264 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/yuanyuanliu/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rubygems.rb:1273 - cannot load such file -- rubygems/defaults/ruby
/Users/yuanyuanliu/.rvm/src/rubygems-3.0.9/lib/rubygems/core_ext/kernel_require.rb:54:in `require': /Users/yuanyuanliu/.rvm/src/rubygems-3.0.9/lib/rubygems/core_ext/kernel_warn.rb:15: syntax error, unexpected tLABEL (SyntaxError)
module_function define_method(:warn) {|*messages, uplevel: nil|
^
/Users/yuanyuanliu/.rvm/src/rubygems-3.0.9/lib/rubygems/core_ext/kernel_warn.rb:18: void value expression
/Users/yuanyuanliu/.rvm/src/rubygems-3.0.9/lib/rubygems/core_ext/kernel_warn.rb:43: syntax error, unexpected '}', expecting keyword_end
from /Users/yuanyuanliu/.rvm/src/rubygems-3.0.9/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/yuanyuanliu/.rvm/src/rubygems-3.0.9/lib/rubygems.rb:1390:in `<top (required)>'
from setup.rb:28:in `require'
from setup.rb:28:in `<main>'
'command gem pristine --version ' failed, you need to fix these gems manually.
Error running '__rvm_with ruby-1.9.3-p551 gemset_pristine',
please read /Users/yuanyuanliu/.rvm/log/1618301825_ruby-1.9.3-p551/gemset.pristine-ruby-1.9.3-p551.log
Making gemset ruby-1.9.3-p551#global pristine - please wait
'command gem pristine --version ' failed, you need to fix these gems manually.
Error running '__rvm_with ruby-1.9.3-p551#global gemset_pristine',
please read /Users/yuanyuanliu/.rvm/log/1618301825_ruby-1.9.3-p551/gemset.pristine-ruby-1.9.3-p551#global.log
Thanks in advance.

#Sam: a lot of users, like myself, are still running production systems on Ruby 1.9.3-p551 even though everyone screams EOL. Ignore them becuase the last I checked, my government (apparently most powerful in the world) is still running on 60 year old COBOL...LOL! Hey, if it's still making you money, why not?
Anyhow, I personally prefer using rbenv to manage my versions of Rubies. So, if you're able to use rbenv, you can follow my instructions below to get up and running with both rbenv and ruby-1.9.3-p551 securely patched with SSLv1, SSLv2, SSLv3 & TLSv1.2:
# 1. Update brew and install OpenSSL/rbenv
brew update
brew install openssl
brew install rbenv
# 2. Set up rbenv in your shell
rbenv init
# 3. Close your Terminal window and open a new one so your changes take effect
# 4. Verify that rbenv is properly set up using this rbenv-doctor script
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
# You should get a response with the following 2 last lines:
# ----------------------------------------------------------
#> Checking RubyGems settings: OK
#> Auditing installed plugins: OK
# 5. Now, time to install Ruby 1.9.3-p551 w/ TLSv1_2 patch
# -- This process takes approx. 3-6mins on a Ubuntu 18.04 VPS
# -- Reference: https://niv.su/arch/ruby/2019/04/01/ruby1.9-openssl.html
rbenv install --force --patch 1.9.3-p551 < <(curl -sSL https://git.io/JOcZw)
# 6. Set, rbenv global and run rbenv rehash (optional)
rbenv global 1.9.3-p551
echo 'gem: --no-document' >> ~/.gemrc
rbenv rehash
# 7. Install Bunder version 1.17.3 as that is the only most recent supported
# -- version with Ruby 1.9.3-p551
gem install bundler -v 1.17.3 --no-rdoc --no-ri
rbenv rehash
# 8. Locate your `bundle` executable and add require 'openssl' right below
# -- require 'rubygems' in that file
gem env | grep "EXECUTABLE DIRECTORY"
#> - EXECUTABLE DIRECTORY: /home/robby/.rbenv/versions/1.9.3-p551/bin
nano /home/robby/.rbenv/versions/1.9.3-p551/bin/bundle
# -- save, exit and run:
rbenv rehash
ruby -v
#> ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
# 9. At this point you should be all set and can run the following
# -- command to ensure Ruby 1.9.3-p551 is successfully installed with the patch
curl -Lks 'https://git.io/rg-ssl' | ruby
# Your output should be similar to this except location directories for your SSL files
# -----------------------------------------------------------------
# Here's your Ruby and OpenSSL environment:
#
# Ruby: 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
# RubyGems: 1.8.23.2
# Bundler: 1.17.3
# Compiled with: OpenSSL 1.0.2n 7 Dec 2017
# SSL_CERT_FILE: /usr/lib/ssl/cert.pem
# SSL_CERT_DIR: /usr/lib/ssl/certs
#
# With that out of the way, let's see if you can connect to rubygems.org...
#
# Bundler connection to rubygems.org: success ✅
# RubyGems connection to rubygems.org: success ✅
# Ruby net/http connection to rubygems.org: success ✅
#
# Hooray! This Ruby can connect to rubygems.org. You are all set to use Bundler and RubyGems. 👌

Related

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.

ERROR: Gem bundler is not installed, run `gem install bundler` first

Hi I've been having a probably trying to install the Ruby gem bundle. I follow the directions gem install bundle after I receive this message, but it still doesn't work when I type bundle -v. I also type
which bundle and receive
/Users/edmundmai/.rvm/bin/bundle
so it exists!! So why does it not work!! Is there something wrong with the mysterious $PATH that I don't get? (I'm a noob).
Here's my .bash_profile:
PATH=$PATH:~/bin
export PATH
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
Here's my .bashrc :
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Here's my gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-darwin11.3.1]
- INSTALLATION DIRECTORY: /Users/edmundmai/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd
- RUBY EXECUTABLE: /Users/edmundmai/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
- EXECUTABLE DIRECTORY: /Users/edmundmai/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-11
- GEM PATHS:
- /Users/edmundmai/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd
- /Users/edmundmai/.rvm/gems/ruby-1.9.3-p194#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "install" => "--no-rdoc --no-ri"
- "update" => "--no-rdoc --no-ri"
- REMOTE SOURCES:
- http://rubygems.org/
echo $PATH
/Users/edmundmai/.rvm/bin:/Users/edmundmai/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/bin:/Users/edmundmai/.rvm/gems/ruby-1.9.3-p194#global/bin:/Users/edmundmai/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/edmundmai/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/edmundmai/bin:/Users/edmundmai/bin
UPDATE
So after trying to go through the RoR tutorial again, I repeated a few of the steps from earlier in the chapter in one of my two terminal windows (let's call them Terminal #1 and Terminal #2). Terminal #2 still doesn't work (the command line isn't on any directory, just the default directory) while Terminal #1 (at my sample_app directory) works. I think rvm get head && rvm reload might be the key? But does that mean I have to run that every time I open my terminal? Check out my terminal #1 commands for before and after (I deleted some of the output so that it would be more clear what my input lines were):
Edmunds-MacBook-Pro:sample_app edmundmai$ bundle -v
ERROR: Gem bundler is not installed, run `gem install bundler` first.
Edmunds-MacBook-Pro:sample_app edmundmai$ gem install
ERROR: While executing gem ... (Gem::CommandLineError)
Please specify at least one gem name (e.g. gem build GEMNAME)
Edmunds-MacBook-Pro:sample_app edmundmai$ rvm -v
rvm 1.15.8 (master) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]
Edmunds-MacBook-Pro:sample_app edmundmai$ rspec spec/
No DRb server is running. Running in local process instead ...
........
Finished in 0.36709 seconds
8 examples, 0 failures
Randomized with seed 59500
Edmunds-MacBook-Pro:sample_app edmundmai$ subl .
Edmunds-MacBook-Pro:sample_app edmundmai$ bundle install --binstubs=./bundler_stubs
Using rake (0.9.2.2)
...
...
(**list of stuff)
Using uglifier (1.2.3)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Edmunds-MacBook-Pro:sample_app edmundmai$ bundle show bundler
/Users/edmundmai/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/bundler-1.2.0
I'm extremely unclear as to what the $PATH does. If you guys need any more info, feel free to tell me and I'll provide it.
I think this is the problem: You have bundler installed to a specific gemset, which is why it's only available when you're in your app's directory (I'm assuming there's a .rvmrc file in there).
You have a few options:
Install bundler to a global gemset. rvm gemset use global && gem install bundler
If you have Homebrew installed, just do brew install ruby and avoid rvm altogether. (There's also rbenv and ry as alternatives to rvm, but I just use 1.9.3 across all my apps, so Homebrew is fine.)
For reference, $PATH is a shell environmental variable containing a list of directories that hold executables (e.g., echo, ls, vim, etc.). It's intrinsic to shells.
Sometimes it is just that you are not sourcing rvm correctly, because you are not in a login shell (using screen?).
Type
source ~/.rvm/scripts/rvm
And use any bundle command.
Add the following line to ~/.bashrc file
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
then reload the file:
$ source ~/.bashrc
Even i had same problem,
In server rvm was not selected as default.So
rvm use 1.9.3 --default
gem install bundler
solved my problem
(Problem occurs only when using rvm)
If you are using rvm create a separate gemset, which are self-contained bundles of gems.
rvm use 1.9.3#myApplicationNameHere --create --default
myApplicationNameHere = change this to your application name
create = creates a gemset
default = means use this version of ruby and gemset as default
Here is the link to the rvm site and the relevant section https://rvm.io/gemsets/basics/

tracks: gem::installerror

I have a problem installing gems for tracks. I performed the following steps:
Installation of rvm:
bash < <(curl -sk https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
source ~/.bashrc
Installation of ruby:
rvm install ruby-1.8.7
rvm use ruby-1.8.7 --default
ruby -v
Last command responds:
ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]
Git clone of tracks:
git clone https://github.com/TracksApp/tracks.git
cd tracks
nano backup.rails2.3/Gemfile.rails2.3
Changes made in this flie:
- comment out gem "sqlite3"
- change gem "ZenTest", "=4.6.0"
After this i performed bundle install which exits with the following error:
Gem::InstallError: factory_girl requires Ruby version >= 1.9.2.
An error occured while installing factory_girl (3.3.0), and Bundler cannot continue.
Make sure that `gem install factory_girl -v '3.3.0'` succeeds before bundling.
Tracks does not support ruby 1.9.x so version upgrade is not possible. How can I fix above mentioned problem?
You have cloned deveopment version which seams be getting ready for Ruby 1.9:
https://github.com/TracksApp/tracks/blob/master/Gemfile#L51
Either use it with ruby 1.9 or use older version:
https://github.com/TracksApp/tracks/tags

rvm gemdir gives error ~/.rvm/scripts/gemsets: line 786: rvm command not found

I get an "rvm: command not found error" on rvm gemdir, but only when I'm using one of the rvm ruby installations. I get the same result with 1.9.2 and 1.8.7 (the only ones I've tried):
$ rvm install 1.8.7
...
Installation of rubygems completed successfully.
...
Install of ruby-1.8.7-p334 - #complete
# works ok using system ruby
$ rvm gemdir
/Library/Ruby/Gems/1.8
$ rvm use 1.8.7
Using /Users/aneil/.rvm/gems/ruby-1.8.7-p334
#
# HERE IS THE ERROR:
#
$ rvm gemdir
/Users/aneil/.rvm/scripts/gemsets: line 786: rvm: command not found
/Users/aneil/.rvm/gems/ruby-1.8.7-p334
$ rvm use system
Now using system ruby.
$ rvm gemdir
/Library/Ruby/Gems/1.8
Any ideas what's going on here? Should I be concerned?
Thanks.
try running
rvm get latest
from shell. addressed the issue for me.

Resources