I try to update gem in my macOS but the following error occurs:
$ RUBYOPT= gem update --system
ERROR: While executing gem ... (NoMethodError)
undefined method `ssl_version=' for #<OpenSSL::SSL::SSLContext:0x007f8561047638>
Did you mean? ssl_timeout=
The output of gem update and gem install {package_name} are the same.
The output of gem env version or gem --version is:
3.0.3
The output of openssl version is:
LibreSSL 2.6.5
How can I resolve the issue?
macOS version: 10.14.4
Output of gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.3
- RUBY VERSION: 2.4.0 (2016-12-24 patchlevel 0) [x86_64-darwin16]
- INSTALLATION DIRECTORY: /Users/adv/.rvm/gems/ruby-2.4.0
- USER INSTALLATION DIRECTORY: /Users/adv/.gem/ruby/2.4.0
- RUBY EXECUTABLE: /Users/adv/.rvm/rubies/ruby-2.4.0/bin/ruby
- GIT EXECUTABLE: /usr/local/bin/git
- EXECUTABLE DIRECTORY: /Users/adv/.rvm/gems/ruby-2.4.0/bin
- SPEC CACHE DIRECTORY: /Users/adv/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/adv/.rvm/rubies/ruby-2.4.0/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-16
- GEM PATHS:
- /Users/adv/.rvm/gems/ruby-2.4.0
- /Users/adv/.rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/adv/.rvm/gems/ruby-2.4.0/bin
- /Users/adv/.rvm/gems/ruby-2.4.0#global/bin
- /Users/adv/.rvm/rubies/ruby-2.4.0/bin
- /Users/adv/.fastlane/bin
- /Library/Frameworks/Python.framework/Versions/3.7/bin
- /usr/local/sbin
- /Users/adv/.rbenv/shims
- /Users/adv/.rvm/bin
- /Users/adv/.fastlane/bin
- /Library/Frameworks/Python.framework/Versions/3.7/bin
- /usr/local/sbin
- /Users/adv/.rbenv/shims
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/share/dotnet
- /Library/Frameworks/Mono.framework/Versions/Current/Commands
- /Users/adv/android-sdks/platform-tools
- /Users/adv/android-sdks/tools
- /opt/metasploit-framework/bin
- /opt/metasploit-framework/bin
- /Users/adv/android-sdks/platform-tools/
- /Users/adv/android-sdks/tools/
- /opt/metasploit-framework/bin
- /opt/metasploit-framework/bin
Output of which gem:
/Users/adv/.rvm/rubies/ruby-2.4.0/bin/gem
Output of rbenv versions:
system
* 2.4.1 (set by /Users/adv/.rbenv/version)
Output of ruby -ropenssl -e "puts OpenSSL::OPENSSL_LIBRARY_VERSION":
OpenSSL 1.1.1b 26 Feb 2019
Output of rvm list:
=* ruby-2.4.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
UPDATE: After I removed rvm and rbenv completely (and restarted the Terminal session), I try to execute gem update again, here is the result:
$ gem update
Updating installed gems
Updating CFPropertyList
Fetching: CFPropertyList-3.0.0.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
I think it now uses macOS's system ruby again.
Here are some outputs:
Output of gem -v:
2.5.2.3
Output of ruby -v:
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
Output of which gem:
/usr/bin/gem
Ouput of which ruby:
/usr/bin/ruby
My aim is to use gem without problems (install & update, etc). What should I do next?
OpenSSL::SSL::SSLContext#ssl_version= appeared in ruby 1.8.7, mac os has 2.3.7 built-in
Just checked on 10.14.2 -
require 'openssl'; OpenSSL::SSL::SSLContext.new.ssl_version="TLSv1"
works fine even on system ruby, OpenSSL versions are the same as yours.
The only thing left to suspect is rbenv conflict with rvm, because you have both installed, it may mess loaded libraries and ruby compilation. I suggest removing one of them completely (also not forget to start new shell session after this) and reinstall broken ruby.
Related
I think I've got a simple problem but I've spent hours searching for the answer. It's taken me a while to get the correct version of ruby installed and recognized when running ruby -v (it had previously been v2.5.1, but for some reason I still can't use the command bundle install. It tells me I've got the wrong version of ruby... but this doesn't appear to be true???
I am trying to deploy a Ruby on Rails repository to an EC2 instance.
Any help would be much appreciated! Thanks in advance.
I have ran these commands from within my repository directory:
ruby -v
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
bundle install
Your Ruby version is 2.5.1, but your Gemfile specified 2.5.3
.bashrc and .bash_profile have the following commands in them:
export PATH="$HOME/.rbenv/bin:~/.rbenv/shims:$PATH"
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
Available versions:
~/.rbenv/versions$ ls
2.5.3
irb
irb(main):001:0> RUBY_VERSION
=> "2.5.3"
rbenv version
2.5.3 (set by /home/ubuntu/.rbenv/version)
whereis ruby
ruby: /usr/bin/ruby
/usr/bin/ruby2.5
/usr/lib/x86_64-linux-gnu/ruby
/usr/lib/ruby
/home/ubuntu/.rbenv/shims/ruby
/snap/bin/ruby.rake /snap/bin/ruby.bundle
/snap/bin/ruby.gem
/snap/bin/ruby.env
/snap/bin/ruby.rdoc
/snap/bin/ruby
/snap/bin/ruby.irb
/snap/bin/ruby.ri
/usr/share/man/man1/ruby.1.gz
gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.7.6
- RUBY VERSION: 2.5.3 (2018-10-18 patchlevel 105) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/ubuntu/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0
- USER INSTALLATION DIRECTORY: /home/ubuntu/.gem/ruby/2.5.0
- RUBY EXECUTABLE: /home/ubuntu/.rbenv/versions/2.5.3/bin/ruby
- EXECUTABLE DIRECTORY: /home/ubuntu/.rbenv/versions/2.5.3/bin
- SPEC CACHE DIRECTORY: /home/ubuntu/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/ubuntu/.rbenv/versions/2.5.3/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/ubuntu/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0
- /home/ubuntu/.gem/ruby/2.5.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "“gem" => "--no-document”"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/ubuntu/.rbenv/versions/2.5.3/bin
- /home/ubuntu/.rbenv/libexec
- /home/ubuntu/.rbenv/plugins/ruby-build/bin
- /home/ubuntu/.rbenv/shims
- /home/ubuntu/.rbenv/bin
- ~/.rbenv/shims
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local
You can try to force an update to your Ruby version in the Gemfile.lock:
bundle update --ruby in the same folder as the Gemfile.
If that didn't work you could also try a:
gem install bundler
Making sure you're in a directory/project that is using ruby 2.5.3 (i.e double check with ruby -v).
Finally you can do a manual rbenv rehash to check it's up-to-date:
rbenv rehash
I've already tried Googling everything; don't just point me towards the first few results you get when Google searching the same error.
This is what I've tried:
ruby 2.0 rails gem install error "cannot load such file -- openssl".
When I try to do gem install rails, I get this error. Frankly it happens when I try to gem install anything.
ERROR: Loading command: install (LoadError)
cannot load such file -- openssl
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
Also, I should have Ruby 2.7.1 installed (I've installed it multiple times with brew, rbenv, and rvm), but when I do ruby -v it always returns ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]. I read somewhere that any Ruby version < 2.4 isn't compatible with OpenSSL 1.1. I need Ruby > 2.4.4 to install rails.
Here's my gem env
[14:21:23] jasper.huang ruby-2.7.1 gem env
RubyGems Environment:
- RUBYGEMS VERSION: 3.1.2
- RUBY VERSION: 2.7.1 (2020-03-31 patchlevel 83) [x86_64-darwin18]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.7.0
- USER INSTALLATION DIRECTORY: /Users/jasper.huang/.gem/ruby/2.7.0
- RUBY EXECUTABLE: /usr/local/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /Users/jasper.huang/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-18
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.7.0
- /Users/jasper.huang/.gem/ruby/2.7.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/jasper.huang/Documents/School/USC/SPRING20/CSCI310/Project2/google-cloud-sdk/bin
- /Library/Frameworks/Python.framework/Versions/3.7/bin
- /usr/local/CrossPack-AVR/bin
- /Library/Frameworks/Python.framework/Versions/3.5/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/share/dotnet
- /opt/X11/bin
- ~/.dotnet/tools
- /Library/Frameworks/Mono.framework/Versions/Current/Commands
- /usr/local/CrossPack-AVR/bin
- /Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin
- /Users/jasper.huang/.rvm/bin
I recently faced this issue and the problem was that ruby command was using core default ruby installation (i.e 2.3) instead of rvm ruby version. I am not sure how this happened but I faced this issue after I installed 'ohmyzsh' plugin. This is again a guess and I am not 100% sure if this plugin caused this issue.
So, I had to uninstall the plugin and re installed rvm and openssl package. Than, install the ruby version with openssl directory as parameter as suggested in the link you have shared.
You can also use the system installed openssl directory as well. Also try using this parameter while installing the gem '-- --with-opt-dir=/usr/local/opt/openssl'. The path should the openssl installed directory on your machine.
You need to make sure that you have rvm and ruby is installed and working fine by checking the ruby installed in rvm is activated in your machine. I hope this helps and please let me know if you have any further queries. Thank you.
Can't create a rails project after installing rails.
Mac Mojave 10.14.6
$ ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin18]
$ which ruby
/usr/local/opt/ruby/bin/ruby
$ gem -v
3.1.2
$ sudo gem install rails
Successfully installed rails-6.0.2.2
Parsing documentation for rails-6.0.2.2
Done installing documentation for rails after 0 seconds
1 gem installed
Then tried to create a rails project
$ rails new blah
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
$ which rails
/usr/bin/rails
Any ideas why I can't create a rails project as rails seems to be installed?
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 3.1.2
- RUBY VERSION: 2.7.1 (2020-03-31 patchlevel 83) [x86_64-darwin18]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.7.0
- USER INSTALLATION DIRECTORY: /Users/shanegibney/.gem/ruby/2.7.0
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- GIT EXECUTABLE: /usr/local/bin/git
- EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/2.7.0/bin
- SPEC CACHE DIRECTORY: /Users/shanegibney/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.7.1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-18
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.7.0
- /Users/shanegibney/.gem/ruby/2.7.0
- /usr/local/Cellar/ruby/2.7.1/lib/ruby/gems/2.7.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/opt/ruby/bin
- /usr/local/opt/ruby/bin
- /usr/local/opt/ruby/bin
- /usr/local/opt/ruby/bin
- /opt/local/bin
- /opt/local/sbin
- /opt/local/bin
- /opt/local/sbin
- /usr/local/sbin
- /usr/local/mysql/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Library/TeX/texbin
- /opt/X11/bin
- /Library/Frameworks/Mono.framework/Versions/Current/Commands
- /opt/ImageMagick/bin
- /Applications/Wireshark.app/Contents/MacOS
Then,
$ /usr/bin/rails new blah
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
-bash: tail: command not found
-bash: sed: command not found
Also tried,
$ export PATH="/usr/bin/rails" >> ~/.bash_profile
-bash: tail: command not found
-bash: sed: command not found
Thanks,
Running bundle install I get the error: "-bash: bundle: command not found"
I can install Bundler with gem install bundler and I get no errors. In fact, if I run gem list it shows bundler (1.14.6). However, bundle -v or anything like that doesn't work.
I have uninstalled bundler and re-installed.
gem env returns:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5.1
- RUBY VERSION: 2.2.3 (2015-08-18 patchlevel 173) [x86_64-darwin15]
- INSTALLATION DIRECTORY: /usr/local/Cellar/ruby/2.2.3/lib/ruby/gems/2.2.0
- RUBY EXECUTABLE: /usr/local/Cellar/ruby/2.2.3/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/Cellar/ruby/2.2.3/bin
- SPEC CACHE DIRECTORY: /Users/mike/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.2.3/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-15
- GEM PATHS:
- /usr/local/Cellar/ruby/2.2.3/lib/ruby/gems/2.2.0
- /Users/mike/.gem/ruby/2.2.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/Cellar/ruby/2.2.3/bin/ruby
- /usr/local/bin/gem
brew doctor says "Your system is ready to brew"
echo $PATH says /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Cellar/ruby/2.2.3/bin/ruby:/usr/local/bin/gem
which gem returns: /usr/local/bin/gem
While this may not be a solution to your current issue, it is an alternative that could help you down the road in developing in Ruby / Rails.
I'd recommend moving to a ruby version control system such as RVM or rbenv where you then have full control over your ruby version on a per-project basis. It's much easier than playing with your system Ruby on OS X too. You'll probably find that once you have one of these installed, your bundler issues disappear.
Well, it's a little bit late answer, but I was able to do it like this:
gem install bundler -n /opt/homebrew/opt/ruby#2.5/bin
Where /opt/homebrew/opt/ruby#2.5/bin is a path where homebrew ruby installation gems is located
Ububtu 14.04
rvm 1.26.11
ruby 2.1.0p0
rvm list :
rvm rubies
=* ruby-2.1.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
which ruby : /home/awlad/.rvm/rubies/ruby-2.1.0/bin/ruby
which rvm : /home/awlad/.rvm/bin/rvm
which bundle: /usr/bin/bundle
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.8
- RUBY VERSION: 2.1.0 (2013-12-25 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/awlad/.rvm/gems/ruby-2.1.0
- RUBY EXECUTABLE: /home/awlad/.rvm/rubies/ruby-2.1.0/bin/ruby
- EXECUTABLE DIRECTORY: /home/awlad/.rvm/gems/ruby-2.1.0/bin
- SPEC CACHE DIRECTORY: /home/awlad/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/awlad/.rvm/rubies/ruby-2.1.0/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/awlad/.rvm/gems/ruby-2.1.0
- /home/awlad/.rvm/gems/ruby-2.1.0#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/awlad/.rvm/gems/ruby-2.1.0/bin
- /home/awlad/.rvm/gems/ruby-2.1.0#global/bin
- /home/awlad/.rvm/rubies/ruby-2.1.0/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /home/awlad/.rvm/bin
- /home/awlad/.rvm/bin
- /home/awlad/.rvm/bin
rvm use 2.1.0 --default then when i run gem install rails -v 4.1.1 I am getting:
ERROR: While executing gem ... (NoMethodError)
undefined method 'ord' for nil:NilClass
UPDATE:
After creating new gemset with ruby 2.1.0 in a project directory when i use this new gemset and trying to install bundle I got :
home/awlad/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler (LoadError)
from /home/awlad/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/bin/bundle:7:in `<main />
After use: \curl -sSL https://get.rvm.io | bash -s stable --rails
It is working for built in ruby version which one was installed by above command. When I am trying to installed other ruby version and gemset then I am getting above bundler load error.
Anyone can help me to get rid of this?
I will provide any other information if needed.
Thanks
I am answering and accepting this question because someone may get help from this.
After investigating few days ( googling, creating new issue in rvm) I have found that it is a Ruby bug was fixed here
I had to upgrade ruby version to 2.1.7 to solve this issue.
You can get details from rvm issue tracker.
Try:
gem update --system
You can also update your system that might solve your problem, see here.
I suppose the problem is that bundle is here /usr/bin/bundle. I am not 100% sure, but I think that gem install bundle will override the bundle in /usr/bin/bundle.