Error upgrading to Ruby 2.2.4 - ruby

I ran rvm install ruby-2.2.4 and got the following error:
$ rvm reinstall ruby-2.2.4
ruby-2.2.4 - #removing src/ruby-2.2.4..
ruby-2.2.4 - #removing rubies/ruby-2.2.4..
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.9/x86_64/ruby-2.2.4.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/JAckerman/.rvm/rubies/ruby-2.2.4, this may take a while depending on your cpu(s)...
ruby-2.2.4 - #downloading ruby-2.2.4, this may take a while depending on your connection...
ruby-2.2.4 - #extracting ruby-2.2.4 to /Users/JAckerman/.rvm/src/ruby-2.2.4....
ruby-2.2.4 - #applying patch /Users/JAckerman/.rvm/patches/ruby/2.2.4/fix_installing_bundled_gems.patch.
ruby-2.2.4 - #configuring..........................................................
ruby-2.2.4 - #post-configuration.
ruby-2.2.4 - #compiling.............................................................
ruby-2.2.4 - #installing............
Error running '__rvm_make install',
showing last 15 lines of /Users/JAckerman/.rvm/log/1454705088_ruby-2.2.4/install.log
from /Users/JAckerman/.rvm/src/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/JAckerman/.rvm/src/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/JAckerman/.rvm/src/ruby-2.2.4/lib/rubygems/dependency_installer.rb:3:in `<top (required)>'
from /Users/JAckerman/.rvm/src/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/JAckerman/.rvm/src/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/JAckerman/.rvm/src/ruby-2.2.4/lib/rubygems.rb:556:in `install'
from ./tool/rbinstall.rb:722:in `block (2 levels) in <main>'
from ./tool/rbinstall.rb:721:in `each'
from ./tool/rbinstall.rb:721:in `block in <main>'
from ./tool/rbinstall.rb:757:in `call'
from ./tool/rbinstall.rb:757:in `block in <main>'
from ./tool/rbinstall.rb:754:in `each'
from ./tool/rbinstall.rb:754:in `<main>'
make: *** [do-install-nodoc] Error 1
++ return 2
There has been an error while running make install. Halting the installation.
I tried these steps, running rvm reinstall ruby-2.2.4 after each step, to no avail:
rvm get head
rvm get master
Then all of this:
$ rvm gem list error
Please note that `rvm gem ...` was removed, try `gem list error` or `rvm all do gem list error` instead. ( see: 'rvm usage' )
JAckerman#Jasons-MacBook-Pro parkme3.1 (staging) $ gem list error
/Users/JAckerman/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/yaml.rb:4: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.
/Users/JAckerman/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Users/JAckerman/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/x86_64-darwin13/psych.bundle, 9): Library not loaded: /usr/local/lib/libyaml-0.2.dylib (LoadError)
Referenced from: /Users/JAckerman/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/x86_64-darwin13/psych.bundle
Reason: image not found - /Users/JAckerman/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/x86_64-darwin13/psych.bundle
from /Users/JAckerman/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/JAckerman/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/psych.rb:1:in `<top (required)>'
from /Users/JAckerman/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/JAckerman/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/JAckerman/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/yaml.rb:5:in `<top (required)>'
from /Users/JAckerman/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/JAckerman/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/JAckerman/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems.rb:624:in `load_yaml'
from /Users/JAckerman/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems/config_file.rb:328:in `load_file'
from /Users/JAckerman/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems/config_file.rb:197:in `initialize'
from /Users/JAckerman/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems/gem_runner.rb:74:in `new'
from /Users/JAckerman/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems/gem_runner.rb:74:in `do_configuration'
from /Users/JAckerman/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems/gem_runner.rb:39:in `run'
from /Users/JAckerman/.rvm/rubies/ruby-2.2.4/bin/gem:21:in `<main>'
JAckerman#Jasons-MacBook-Pro parkme3.1 (staging) $ brew install libyaml
Warning: libyaml-0.1.6 already installed
JAckerman#Jasons-MacBook-Pro parkme3.1 (staging) $ brew reinstall libyaml
==> Reinstalling libyaml
Warning: libyaml-0.1.6 already installed
JAckerman#Jasons-MacBook-Pro parkme3.1 (staging) $ brew unlink libyaml
Unlinking /usr/local/Cellar/libyaml/0.1.6... 1 symlinks removed
JAckerman#Jasons-MacBook-Pro parkme3.1 (staging) $ brew reinstall libyaml
==> Reinstalling libyaml
Warning: libyaml-0.1.6 already installed, it's just not linked
JAckerman#Jasons-MacBook-Pro parkme3.1 (staging) $ brew link libyaml
Linking /usr/local/Cellar/libyaml/0.1.6... 5 symlinks created
Then I re-tried rvm get head and rvm get master, reinstalling after each.

Install / update autoconf brew install autoconf

The issue was that, while most of the above was right, none of it was working because my homebrew was not up to date, which I figured out by running brew doctor. Updating home brew (brew update) and then reinstalling the necessary libraries got it working.

Related

rbenv ruby 2.7.2 installation fails: "BUILD FAILED"

I am getting this strange error while trying to install ruby 2.7.2 using rbenv.
Does anybody know what the issue is?
$ rbenv install 2.7.2
Installing ruby-2.7.2...
BUILD FAILED (Ubuntu 20.04 using ruby-build 20201005-4-g4761049)
Inspect or clean up the working tree at /tmp/ruby-build.20201106211003.49727.I05SRV
Results logged to /tmp/ruby-build.20201106211003.49727.log
Last 10 log lines:
from ./tool/rbinstall.rb:846:in `block (2 levels) in install_default_gem'
from ./tool/rbinstall.rb:279:in `open_for_install'
from ./tool/rbinstall.rb:845:in `block in install_default_gem'
from ./tool/rbinstall.rb:835:in `each'
from ./tool/rbinstall.rb:835:in `install_default_gem'
from ./tool/rbinstall.rb:799:in `block in <main>'
from ./tool/rbinstall.rb:950:in `block in <main>'
from ./tool/rbinstall.rb:947:in `each'
from ./tool/rbinstall.rb:947:in `<main>'
make: *** [uncommon.mk:373: do-install-all] Error 1
EDIT: Below is the content of the .log file (the full version is 197'000 lines long, so I can only post the last part).
And at the end, it says:
ruby-2.7.2/lib/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- openssl (LoadError)
However, I DO have openssl installed (I use it). What am I missing?
generating x86_64-linux-fake.rb
x86_64-linux-fake.rb updated
./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems -r./x86_64-linux-fake ./tool/rbinstall.rb --make="make" --dest-dir="" --extout=".ext" --mflags="" --make-flags="" --data-mode=0644 --prog-mode=0755 --installed-list .installed.list --mantype="doc" --rdoc-output=".ext/rdoc" --html-output=".ext/html"
installing binary commands: /home/tom/.rbenv/versions/2.7.2/bin
installing base libraries: /home/tom/.rbenv/versions/2.7.2/lib
installing arch files: /home/tom/.rbenv/versions/2.7.2/lib/ruby/2.7.0/x86_64-linux
installing pkgconfig data: /home/tom/.rbenv/versions/2.7.2/lib/pkgconfig
installing extension objects: /home/tom/.rbenv/versions/2.7.2/lib/ruby/2.7.0/x86_64-linux
installing extension objects: /home/tom/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/x86_64-linux
installing extension objects: /home/tom/.rbenv/versions/2.7.2/lib/ruby/vendor_ruby/2.7.0/x86_64-linux
installing extension headers: /home/tom/.rbenv/versions/2.7.2/include/ruby-2.7.0/x86_64-linux
installing extension scripts: /home/tom/.rbenv/versions/2.7.2/lib/ruby/2.7.0
installing extension scripts: /home/tom/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0
installing extension scripts: /home/tom/.rbenv/versions/2.7.2/lib/ruby/vendor_ruby/2.7.0
installing extension headers: /home/tom/.rbenv/versions/2.7.2/include/ruby-2.7.0/ruby
installing rdoc: /home/tom/.rbenv/versions/2.7.2/share/ri/2.7.0/system
installing html-docs: /home/tom/.rbenv/versions/2.7.2/share/doc/ruby
installing capi-docs: /home/tom/.rbenv/versions/2.7.2/share/doc/ruby
installing command scripts: /home/tom/.rbenv/versions/2.7.2/bin
installing library scripts: /home/tom/.rbenv/versions/2.7.2/lib/ruby/2.7.0
installing common headers: /home/tom/.rbenv/versions/2.7.2/include/ruby-2.7.0
installing manpages: /home/tom/.rbenv/versions/2.7.2/share/man (man1, man5)
installing default gems from lib: /home/tom/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0 (build_info, cache, doc, extensions, gems, specifications)
benchmark 0.1.0
/tmp/ruby-build.20201107153545.4938.VEdjtZ/ruby-2.7.2/lib/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- openssl (LoadError)
from /tmp/ruby-build.20201107153545.4938.VEdjtZ/ruby-2.7.2/lib/rubygems/core_ext/kernel_require.rb:92:in `require'
from /tmp/ruby-build.20201107153545.4938.VEdjtZ/ruby-2.7.2/lib/rubygems/specification.rb:2430:in `to_ruby'
from ./tool/rbinstall.rb:846:in `block (2 levels) in install_default_gem'
from ./tool/rbinstall.rb:279:in `open_for_install'
from ./tool/rbinstall.rb:845:in `block in install_default_gem'
from ./tool/rbinstall.rb:835:in `each'
from ./tool/rbinstall.rb:835:in `install_default_gem'
from ./tool/rbinstall.rb:799:in `block in <main>'
from ./tool/rbinstall.rb:950:in `block in <main>'
from ./tool/rbinstall.rb:947:in `each'
from ./tool/rbinstall.rb:947:in `<main>'
make: *** [uncommon.mk:373: do-install-all] Error 1
Long story short, I found out that libssl-dev and libreadline-dev were required, so this solved the problem:
sudo apt-get install libssl-dev libreadline-dev
In RHEL8/CENTOS8:
sudo yum install readline-devel openssl-devel
assuming you already ran:
sudo yum groupinstall "Development Tools"

Installing Ruby using rbenv on Deepin 15.10

Trying to install Ruby using rbenv (or any other installer I tried RVM and ruby-install) fails and gives this error
$ rbenv install 2.6.3
> Downloading ruby-2.6.3.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.3.tar.bz2
Installing ruby-2.6.3...
ruby-build: use readline from homebrew
BUILD FAILED (Deepin 15.10 using ruby-build 20190423)
Inspect or clean up the working tree at /tmp/ruby-build.20190507002901.29361
Results logged to /tmp/ruby-build.20190507002901.29361.log
Last 10 log lines:
from /tmp/ruby-build.20190507002901.29361/ruby-2.6.3/lib/rubygems/package.rb:44:in `<top (required)>'
from /tmp/ruby-build.20190507002901.29361/ruby-2.6.3/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /tmp/ruby-build.20190507002901.29361/ruby-2.6.3/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /tmp/ruby-build.20190507002901.29361/ruby-2.6.3/lib/rubygems/installer.rb:11:in `<top (required)>'
from /tmp/ruby-build.20190507002901.29361/ruby-2.6.3/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /tmp/ruby-build.20190507002901.29361/ruby-2.6.3/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from ./tool/rbinstall.rb:703:in `<module:RbInstall>'
from ./tool/rbinstall.rb:639:in `<main>'
uncommon.mk:364: recipe for target 'do-install-all' failed
make: *** [do-install-all] Error 1
FINALLY FIXED IT !!
I had to use brew unlink openssl
then sudo apt-get install -y libssl-dev zlib1g-dev
then i tried rbenv install 2.6.3 and IT WORKED !
Try this:
$ TMPDIR=~/tmp/ rbenv install 2.6.3

Building ruby with rbenv and ruby-build fails with undefined symbol: SSLv2_method

I'm trying to install ruby 2.2.4 or 2.3.0 on my Synology DS215j which has an ARMv7 processor. I used optware-ng to install gcc, make, openssl, openssl-dev and zlib. I installed rbenv (version 1.0.0-19-g29b4da7) and the ruby-build plugin according to the instructions in the README.
These are the package and their versions installed with optware-ng
binutils - 2.25.1-1
gcc - 5.3.0-6
gconv-modules - 2.21-3
glibc-opt - 2.21-4
libc-dev - 2.21-1
libgmp - 6.0.0a-1
libmpc - 1.0.2-1
libmpfr - 3.1.3-1
libnsl - 2.21-3
libstdc++ - 6.0.21-6
make - 4.1-1
ncurses - 5.7-4
openssl - 1.0.2f-1
openssl-dev - 1.0.2f-1
readline - 6.1-2
ruby - 2.2.0-1
screen - 4.2.1-2
termcap - 1.3.1-3
zlib - 1.2.8-2
When I run rbenv install 2.2.4 or rbenv install 2.3.0 in both cases the build fails with the error message "undefined symbol: SSLv2_method". This is the error for the 2.2.4 build:
installing bundle gems: /var/services/homes/florian/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0 (build_info, cache, doc, extensions, gems, specifications)
/tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require': /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/.ext/armv7l-linux-eabihf/openssl.so: undefined symbol: SSLv2_method - /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/.ext/armv7l-linux-eabihf/openssl.so (LoadError)
from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/.ext/common/openssl.rb:17:in `<top (required)>'
from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/security.rb:11:in `<top (required)>'
from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/package.rb:43:in `<top (required)>'
from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/dependency_installer.rb:3:in `<top (required)>'
from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems.rb:556:in `install'
from ./tool/rbinstall.rb:722:in `block (2 levels) in <main>'
from ./tool/rbinstall.rb:721:in `each'
from ./tool/rbinstall.rb:721:in `block in <main>'
from ./tool/rbinstall.rb:757:in `call'
from ./tool/rbinstall.rb:757:in `block in <main>'
from ./tool/rbinstall.rb:754:in `each'
from ./tool/rbinstall.rb:754:in `<main>'
uncommon.mk:246: recipe for target 'do-install-all' failed
make: *** [do-install-all] Error 1
This seems to be related to something in rubygems.
Interestingly, the reason why I try to build ruby myself is, that the ruby version delivered with Synology 6 returns a similar error when I try to install gems:
florian#synology:~/.rbenv/plugins$ /usr/bin/gem install rails
ERROR: Loading command: install (LoadError)
/usr/lib/ruby/2.3.0/armle-linux-gnu/openssl.so: undefined symbol: SSLv2_method - /usr/lib/ruby/2.3.0/armle-linux-gnu/openssl.so
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
What could cause these issues and how could I resolve them?
When I run rbenv install 2.2.4 or rbenv install 2.3.0 in both cases the build fails with the error message "undefined symbol: SSLv2_method"...
What could cause these issues ...
The SSLv2 gear was completely removed from OpenSSL in March due to CVE-2016-0800 (DROWN Attack).
I think the complete removal was a bit harsh because of the effects like you are experiencing. There should have been a warning and transition period. And it should have occurred 10 years ago or so.
Instead of complete removal due to DROWN, I think SSLv2_method, SSLv2_client_method and SSLv2_server_method should have set an appropriate error code like ERR_R_REMOVED_INSECURE and returned NULL. <openssl/opensslconf.h> should have unconditionally set OPENSSL_NO_SSL2 also.
OpenSSL realized they broke ABI compatibility and added the symbols back to 1.0.2 with Commit 133138569f37d149. The check-in provided the symbols SSLv2_method, SSLv2_client_method and SSLv2_server_method again, but they return NULL without setting an error code. They also do not define OPENSSL_NO_SSL2. Also see [openssl.org #4398] BUG / 1.0.2g breaks CURL extension.
SSLv2 has been insecure for 15 or 20 years. Packages like Ruby should not have been referencing the symbols. You should file a security bug report against Ruby for referencing the symbol.
... and how could I resolve them?
To fix the issue, I believe you need either (1) wait for OpenSSL 1.0.2h, (2), manually patch OpenSSL 1.0.2g, or (3) remove all Ruby references to SSLv2_method, SSLv2_client_method and SSLv2_server_method.
Here's the patch you need for (2), manually patch OpenSSL 1.0.2g:
diff --git a/ssl/s2_meth.c b/ssl/s2_meth.c
index b312f17..d46e2f5 100644
--- a/ssl/s2_meth.c
+++ b/ssl/s2_meth.c
## -74,8 +74,8 ## IMPLEMENT_ssl2_meth_func(SSLv2_method,
ssl2_accept, ssl2_connect, ssl2_get_method)
#else /* !OPENSSL_NO_SSL2 */
-# if PEDANTIC
-static void *dummy = &dummy;
-# endif
+SSL_METHOD *SSLv2_method(void) { return NULL; }
+SSL_METHOD *SSLv2_client_method(void) { return NULL; }
+SSL_METHOD *SSLv2_server_method(void) { return NULL; }
#endif
You should also configure and compile OpenSSL with at least no-ssl2 no-ssl3 no-comp flags because they are known security problems. The configure options define OPENSSL_NO_SSL2, OPENSSL_NO_SSL3 and OPENSSL_NO_COMP in <openssl/opensslconf.h>.
After several attempts and lots of searching I found this ruby-build issue and reread the instructions in the ruby-build wiki which are suggesting for other platforms to install autoconf. I installed automaker, autoconf and gdbm (which I found some warnings in the ruby-build logs) with ipkg which didn't directly help. Only after I prefixed rbenv with RUBY_CONFIGURE_OPTS=--with-openssl-dir=/opt it worked.
For reference, these are the packages I have installed with ipkg
autoconf - 2.69-1
automake - 1.15-3
binutils - 2.25.1-1
gcc - 5.3.0-6
gconv-modules - 2.21-3
gdbm - 1.8.3-4
glibc-opt - 2.21-4
libc-dev - 2.21-1
libgmp - 6.0.0a-1
libmpc - 1.0.2-1
libmpfr - 3.1.3-1
libnsl - 2.21-3
libstdc++ - 6.0.21-6
m4 - 1.4.17-1
make - 4.1-1
ncurses - 5.7-4
openssl - 1.0.2f-1
openssl-dev - 1.0.2f-1
readline - 6.1-2
ruby - 2.2.0-1
screen - 4.2.1-2
termcap - 1.3.1-3
zlib - 1.2.8-2
This is the rbenv command which worked for me in the end
RUBY_CONFIGURE_OPTS=--with-openssl-dir=/opt rbenv install 2.3.0 -v

How to install ruby(rubygems) with openssl?

When running rvm rubygems latest I get the error.
How fix it?
Error running 'env GEM_PATH=/Users/sjc/.rvm/gems/ruby-2.0.0-p0:/Users/
sjc/.rvm/gems/ruby-2.0.0-p0#global:/Users/sjc/.rvm/gems/ruby-2.0.0-p0:
/Users/sjc/.rvm/gems/ruby-2.0.0-p0#global GEM_HOME=/Users/sjc/.rvm/gem
s/ruby-2.0.0-p0 /Users/sjc/.rvm/rubies/ruby-2.0.0-p0/bin/ruby /Users/s
jc/.rvm/src/rubygems-2.0.0/setup.rb', please read /Users/sjc/.rvm/log/
ruby-2.0.0-p0/rubygems.install.log
The log (rubygems.install.log) has this:
[2013-03-05 20:31:37] /Users/sjc/.rvm/rubies/ruby-2.0.0-p0/bin/ruby
/Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- openssl (LoadError)
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/security.rb:8:in `<top (required)>'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/package.rb:43:in `<top (required)>'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/installer.rb:8:in `<top (required)>'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/request_set.rb:5:in `<top (required)>'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems.rb:195:in `finish_resolve'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/rdoc.rb:14:in `<top (required)>'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/uninstaller.rb:10:in `<top (required)>'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/commands/setup_command.rb:440:in `uninstall_old_gemcutter'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/commands/setup_command.rb:144:in `execute'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/command.rb:305:in `invoke_with_build_args'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/command_manager.rb:170:in `process_args'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/command_manager.rb:130:in `run'
from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/gem_runner.rb:60:in `run'
from setup.rb:45:in `<main>'
RubyGems 2.0.0 installed
Because I didn't know what I was doing, I think my earlier attempt at installing sass may have caused this. I followed these instructions, thus doing these commands earlier in the day.
$ export GEM_HOME=/home/mygemrepository
$ ruby setup.rb --prefix=/home/mystuff
Again, I don't if that matters as GEM_HOME and GEM_PATH seem correct.
$ echo $GEM_HOME
/Users/sjc/.rvm/gems/ruby-2.0.0-p0
$ echo $GEM_PATH
/Users/sjc/.rvm/gems/ruby-2.0.0-p0:/Users/sjc/.rvm/gems/ruby-2.0.0-p0#global
Looks like you're missing openssl. Checkout: https://rvm.io/packages/openssl/
Examples for ruby 2.3.1, or may be other version of ruby.
Without reinstall rvm:
rvm pkg install openssl
rvm install 2.3.1 --with-openssl-dir=$HOME/.rvm/usr
Or with reinstall rvm:
rvm implode
\curl -sSL https://get.rvm.io | bash
rvm pkg install openssl
rvm install 2.3.1 --with-openssl-dir=$HOME/.rvm/usr
Or with custom rubygems for ruby < 2.3:
rvm pkg install openssl
rvm install 2.2.2 --rubygems 2.7.10 --with-openssl-dir=$HOME/.rvm/usr
PS: after all may be reinstall all ruby versions
rvm reinstall all --force
Another possible issue is if your default version of Ruby is old.
Most OS come preinstalled with Ruby, but use an older versions of Ruby (1.8.x), rather than 2.x or even 1.9.x and that may cause the new version of rvm to fail.
$ rvm list
to see the list of ruby versions install, and use ("ruby use uby-1.9.3-p429" equivalent ) to set that and then try :
$ rvm get stable
(get the most recent bugfixes and ruby version updates )
$ rvm rubygems latest
I also changed the default ruby :
$ rvm --default use 1.9.2
worked for me!

Troubles with ruby-2.X installation using RVM

I recently came across of the ruby-2.0.0-p0 installation. After the successfully installation of the rvm i type the following command at the bash.
rvm install ruby-2.0.0-p0
This this the result log.
Searching for binary rubies, this might take some time.
No binary rubies available for: debian/wheezy_sid/i386/ruby-2.0.0-p0.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Installing Ruby from source to: /home/javier/.rvm/rubies/ruby-2.0.0-p0, this may take a while depending on your cpu(s)...
ruby-2.0.0-p0 - #downloading ruby-2.0.0-p0, this may take a while depending on your connection...
ruby-2.0.0-p0 - #extracting ruby-2.0.0-p0 to /home/javier/.rvm/src/ruby-2.0.0-p0
ruby-2.0.0-p0 - #extracted to /home/javier/.rvm/src/ruby-2.0.0-p0
ruby-2.0.0-p0 - #configuring
ruby-2.0.0-p0 - #compiling
ruby-2.0.0-p0 - #installing
Removing old Rubygems files...
Installing rubygems-2.0.0 for ruby-2.0.0-p0 ...
Error running 'env GEM_PATH=/home/javier/.rvm/gems/ruby-2.0.0-p0:/home/javier/.rvm/gems/ruby-2.0.0-p0#global:/home/javier/.rvm/gems/ruby-2.0.0-p0:/home/javier/.rvm/gems/ruby-2.0.0-p0#global GEM_HOME=/home/javier/.rvm/gems/ruby-2.0.0-p0 /home/javier/.rvm/rubies/ruby-2.0.0-p0/bin/ruby /home/javier/.rvm/src/rubygems-2.0.0/setup.rb', please read /home/javier/.rvm/log/ruby-2.0.0-p0/rubygems.install.log
Installation of rubygems did not complete successfully.
Saving wrappers to '/home/javier/.rvm/bin'.
ruby-2.0.0-p0 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-2.0.0-p0 - #importing default gemsets, this may take time ...
Install of ruby-2.0.0-p0 - #complete
Making gemset ruby-2.0.0-p0 pristine.
Error running '' under ,
please read /home/javier/.rvm/log/ruby-2.0.0-p0/gemset.pristine.log
Making gemset ruby-2.0.0-p0#global pristine.
Error running '' under ,
please read /home/javier/.rvm/log/ruby-2.0.0-p0/gemset.pristine.log
Note that the process goes without troubles until the installation of ruby gems.
What's going on here ??
Any help appreciated.
First comment output
cat /home/javier/.rvm/log/ruby-2.0.0-p0/rubygems.install.log
/home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- openssl (LoadError)
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/security.rb:8:in `<top (required)>'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/package.rb:43:in `<top (required)>'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/installer.rb:8:in `<top (required)>'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/request_set.rb:5:in `<top (required)>'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems.rb:195:in `finish_resolve'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/rdoc.rb:14:in `<top (required)>'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/uninstaller.rb:10:in `<top (required)>'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/commands/setup_command.rb:440:in `uninstall_old_gemcutter'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/commands/setup_command.rb:144:in `execute'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/command.rb:305:in `invoke_with_build_args'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/command_manager.rb:170:in `process_args'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/command_manager.rb:130:in `run'
from /home/javier/.rvm/src/rubygems-2.0.0/lib/rubygems/gem_runner.rb:60:in `run'
from setup.rb:45:in `<main>'
RubyGems 2.0.0 installed
Second comment output And the other command
rvm use --default 2.0.0
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 a example.
Try the following
$ rvm remove 2.0.0 # get rid of unsuccessful installation
$ rvm get head --autolibs=3 # get the latest RVM and build required libs
$ rvm requirements # just in case, install all other required stuff
$ rvm install ruby-2.0.0
If at any of those commands fails at any point. Update your question with the logs.
I had this exact same problem. The solution was elegant and simple.
Just update your gems direct from the command line:
sudo gem update --system
That's it!
Terminal will now show:
Updating RubyGems
Updating rubygems-update
Successfully installed rubygems-update-2.0.3
Updating RubyGems to 2.0.3
Installing RubyGems 2.0.3
RubyGems 2.0.3 installed
I had this exact same problem, same error message, etc. I don't know about you, but I use MacPorts, and through that I have libraries like OpenSSL installed, which I think may have contributed to my trouble.
I just got it working on my system; I'm not sure exactly what I did right but here are the steps I took:
Set up my ~/.rvmrc to match the first code block here.
Uninstalled 2.0.0 through rvm (rvm remove 2.0.0).
Removed the folders for ruby-2.0.0, rubygems-2.0.0 and the dependency packages like OpenSSL and YAML in ~/.rvm/src.
Executed rvm install 2.0.0 --with-opt-dir=/opt/local --autolibs=0. /opt/local is my MacPorts prefix directory, and autolibs=0 disables any dependency installation so it didn't have the opportunity to use something other than my MacPorts libraries. If you get through this step without red console output you're past the errors you were having above.
Not knowing if having an empty default gemset was the problem I also ran rvm use --create 2.0.0#... to get a non-default gemset created and then (successfully) installed a gem and its dependencies into it.
I hope this helps!
Open Up the Terminal and then Go to Edit > Profile Preferences and then go to the Tab "Title and Command" and Check "Run Command as Login Shell".
Boot Up a Bash and Now you can install Gems directly from the terminal without the use of sudo and the error "RVM is not a function, selecting rubies with 'rvm use ...' will not work." will be eliminated.
Cheers.

Resources