bundle install failed because of openssl - ruby

when I run bundle install , I get message bellow on console .
it seems all these message are related to openssl
how can I fix this error?
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_VERSION
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_LIBRARY_VERSION
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_VERSION_NUMBER
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_FIPS
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::BN::CONSTTIME
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::Config::DEFAULT_CONFIG_FILE
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_VERSION
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_LIBRARY_VERSION
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_VERSION_NUMBER
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_FIPS
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::BN::CONSTTIME
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::Config::DEFAULT_CONFIG_FILE
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_VERSION
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_LIBRARY_VERSION
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_VERSION_NUMBER
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_FIPS
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::BN::CONSTTIME
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::Config::DEFAULT_CONFIG_FILE
/opt/homebrew/lib/ruby/site_ruby/3.2.0/rubygems.rb:322:in `clear_paths': undefined method `reset' for Gem::Security:Module (NoMethodError)
Gem::Security.reset if defined?(Gem::Security)
^^^^^^
from /opt/homebrew/lib/ruby/site_ruby/3.2.0/bundler/rubygems_integration.rb:174:in `clear_paths'
...
i searched the internet about this but got little about this error

It's possible that it's just a mismatch on your version of rubygems and your version of Ruby that you can resolve by updating rubygems:
gem update --system
I say possible but I don't expect that will work. Generally, esoteric problems like this are best resolved by purging and starting again from scratch. That would mean:
Uninstall Ruby (brew uninstall ruby)
Uninstall OpenSSL (brew uninstall openssl)
Reinstall both
Try bundle install again
But it's also possible that won't work either because it's the same tooling that got you into this situation. What I'd recommend instead is that you use a version manager for Ruby. Tools like asdf and rbenv and rvm will download and compile Ruby from scratch, and if they need a specific version of OpenSSL to do so then they'll download that during the compilation process so that you don't have to.
Version managers are preferred over brew because they only update when you tell them to. If you install Ruby with a manager and it works then it will continue to work; if you install with brew then brew will update and upgrade Ruby as it sees fit, even when you're not intending to update it.
Switching to a version manager will have some initial overhead in terms of effort but it's likely to save you a lot of time and headaches over the long term.

as #anothermh mentioned ,do not use brew to install ruby ,use rvm instead
install rvm
brew uninstall ruby
install ruby and specify openssl path
rvm install 3.2.0 --with-openssl-dir=$(brew --prefix openssl)
it works for me

Related

etc.bundle => warning: already initialized constant

When I run Ruby scripts, I get 157 lines of warning messages like this:
/Users/clay/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/x86_64-darwin19/etc.bundle: warning: already initialized constant Etc::SC_AIO_LISTIO_MAX
/Users/clay/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/x86_64-darwin19/etc.bundle: warning: already initialized constant Etc::SC_AIO_MAX
/Users/clay/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/x86_64-darwin19/etc.bundle: warning: already initialized constant Etc::SC_AIO_PRIO_DELTA_MAX
... lots more
After some digging, it seems like the Ruby/gem/bundle industrial complex is using both the RVM version of Ruby 2.6.3 and the macOS system version of 2.6.3 in order to resolve the etc gem.
My hard-won quick-fix is to uninstall the rvm-ruby's etc gem, like:
rvm use 2.6.3
gem uninstall etc
However, anytime I initiate a gem update on this version of Ruby, etc will get reinstalled, and I'm back to a torrent o' warnings. I cannot get the system-ruby to uninstall etc at all.
Is there a more permanent fix?
Deets:
rvm 1.29.9
macOS Catalina 10.15.2
It appears I can suppress installing the etc gem in my Gemfile, like this:
source 'https://rubygems.org'
ruby '2.6.3'
gem 'cocoapods', '1.9.1'
# ... other gems
gem 'etc', :require => false
Because the system etc gem is already, um, "on the path", it all seems to work for now, but yikes, do not like.

jekyll 3.1.6 | Error: uninitialized constant Jekyll::Filters::URLFilters

Hello Jekyll support users
I need serve this repository on Jekyll, but I has this error on Ubuntu 17.04 Terminal
geraldo#geraldo-Dell-System-XPS-L322X:~/Documentos/activate.mozilla.community$ bundle exec jekyll serve --config ./_config-dev.yml
/var/lib/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/drops/document_drop.rb:8: warning: already initialized constant Jekyll::Drops::DocumentDrop::NESTED_OBJECT_FIELD_BLACKLIST
/usr/lib/ruby/vendor_ruby/jekyll/drops/document_drop.rb:8: warning: previous definition of NESTED_OBJECT_FIELD_BLACKLIST was here
/var/lib/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/drops/drop.rb:8: warning: already initialized constant Jekyll::Drops::Drop::NON_CONTENT_METHODS
/usr/lib/ruby/vendor_ruby/jekyll/drops/drop.rb:8: warning: previous definition of NON_CONTENT_METHODS was here
Configuration file: ./_config-dev.yml
Configuration file: ./_config-dev.yml
jekyll 3.1.6 | Error: uninitialized constant Jekyll::Filters::URLFilters
Anyone here to help me?
I had this problem and it turned out to be that I was using Jekyll from Ubuntu (giving version 3.1.6, as you have) instead of a recent one (such as 3.6.2). Removing jekyll with:
sudo apt-get remove jekyll
and then strictly using bundle cleared things up. Also maybe try bundle update.

All Jekyll's functions don't work any more

Jekyll used to work on my computer. But after I tried to install octopress, it doesn't work any more.
I do not know where is the problem but when I try anything else on terminal, it gives this output.
seniorokur#dell-Inspiron-5521:~/Masaüstü$ jekyll new sds
/usr/lib/ruby/vendor_ruby/jekyll/tags/highlight.rb:11: warning: already initialized constant Jekyll::Tags::HighlightBlock::SYNTAX
/var/lib/gems/2.1.0/gems/jekyll-2.5.3/lib/jekyll/tags/highlight.rb:11: warning: previous definition of SYNTAX was here
/usr/lib/ruby/vendor_ruby/jekyll/tags/include.rb:16: warning: already initialized constant Jekyll::Tags::IncludeTag::VALID_SYNTAX
/var/lib/gems/2.1.0/gems/jekyll-2.5.3/lib/jekyll/tags/include.rb:18: warning: previous definition of VALID_SYNTAX was here
/usr/lib/ruby/vendor_ruby/jekyll/tags/include.rb:17: warning: already initialized constant Jekyll::Tags::IncludeTag::VARIABLE_SYNTAX
/var/lib/gems/2.1.0/gems/jekyll-2.5.3/lib/jekyll/tags/include.rb:19: warning: previous definition of VARIABLE_SYNTAX was here
/usr/lib/ruby/vendor_ruby/jekyll/tags/post_url.rb:4: warning: already initialized constant Jekyll::Tags::PostComparer::MATCHER
/var/lib/gems/2.1.0/gems/jekyll-2.5.3/lib/jekyll/tags/post_url.rb:4: warning: previous definition of MATCHER was here
/var/lib/gems/2.1.0/gems/jekyll-2.5.3/bin/jekyll:16:in `<top (required)>': undefined method `require_from_bundler' for Jekyll::PluginManager:Class (NoMethodError)
from /usr/local/bin/jekyll:23:in `load'
from /usr/local/bin/jekyll:23:in `<main>'
I couldn't search something for solving the problem because I do not know what is the problem. What should I do?
It seems like you have installed jekyll via packagemanager and also via gem
uninstall the packagemanager version with
sudo apt-get remove --purge jekyll
and install the gem again:
sudo gem install jekyll jekyll-watch
It seems that you have a collision somewhere
Try a :
gem cleanup jekyll
gem update
Edit:
You have one jekyll in /usr/lib/ruby/vendor_ruby/jekyll/ and one in /var/lib/gems/2.1.0/gems/jekyll-2.5.3/ I think the first one needs to be removed.

Rake error: Stack level too deep

I know this is a common question, but I just started a project with the new Rails 3.1.0 and Ruby 1.9.2 p290
On my first migrations I had already this error and I am not sure why.
Aurelien$ rake db:migrate --trace
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/version.rb:4: warning: already initialized constant MAJOR
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/version.rb:5: warning: already initialized constant MINOR
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/version.rb:6: warning: already initialized constant BUILD
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/version.rb:3: warning: already initialized constant NUMBERS
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/version.rb:9: warning: already initialized constant VERSION
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake.rb:26: warning: already initialized constant RAKEVERSION
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/early_time.rb:17: warning: already initialized constant EARLY
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/alt_system.rb:32: warning: already initialized constant WINDOWS
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/application.rb:28: warning: already initialized constant DEFAULT_RAKEFILES
WARNING: Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already exists
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/task_arguments.rb:73: warning: already initialized constant EMPTY_TASK_ARGS
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/invocation_chain.rb:49: warning: already initialized constant EMPTY
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/file_utils.rb:10: warning: already initialized constant RUBY
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/file_utils.rb:84: warning: already initialized constant LN_SUPPORTED
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/dsl_definition.rb:143: warning: already initialized constant Commands
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/file_list.rb:44: warning: already initialized constant ARRAY_METHODS
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/file_list.rb:47: warning: already initialized constant MUST_DEFINE
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/file_list.rb:51: warning: already initialized constant MUST_NOT_DEFINE
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/file_list.rb:55: warning: already initialized constant SPECIAL_RETURN
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/file_list.rb:61: warning: already initialized constant DELEGATING_METHODS
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/file_list.rb:364: warning: already initialized constant DEFAULT_IGNORE_PATTERNS
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/file_list.rb:370: warning: already initialized constant DEFAULT_IGNORE_PROCS
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake.rb:64: warning: already initialized constant FileList
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake.rb:65: warning: already initialized constant RakeFileUtils
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
stack level too deep
/Users/Aurelien/.rvm/gems/ruby-1.9.2-p290#rails3/gems/rake-0.9.2/lib/rake/task.rb:162
I also removed the gems and re-tyring with db:reset
source 'http://rubygems.org'
gem 'rails', '3.1.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
#gem "rspec-rails", :group => [:test, :development]
group :test do
#gem "factory_girl_rails"
#gem "capybara"
#gem "guard-rspec"
#gem "spork", "> 0.9.0.rc"
#gem "guard-spork"
end
The rake commands work with bundle exec, but it would be nice to avoid using it.
Thank you in advance for tips and answers.
Aurelien
You should specifically add Rake version >= 0.9.2 in your Gemfile!
There was a bug with some Rails 3 versions where you would see strange errors like this when you use an older Rake version.
In your Gemfile:
gem 'rake' , '>= 0.9.2'
I'd also recommend you create a new gemset specifically for your application, e.g.
rvm gemset create yourproject
rvm gemset use yourproject
or:
rvm gemset use yourproject --default
for the new gemset, you might have to add "gem install rake" manually, then run "bundle install"
Using a separate gemset in addition to using your Gemfile is the best way to keep your gem versions in your project stable, and decoupled from other projects.

Ruby 1.9.2-p290 through rbenv produces warning from psych-1.2.1: VERSION and LIBYAML_VERSION

When I running ruby I get the following warnings:
~/.gem/gems/psych-1.2.1/lib/psych.rb:93: warning: already initialized constant VERSION
~/.gem/gems/psych-1.2.1/lib/psych.rb:96: warning: already initialized constant LIBYAML_VERSION
I've tried googling around but can seem to find a solution which makes me think it's specific to my system. Is there a way to fix this?
This problem seems to originate in psych being called by bundler in Bundler.setup. The work-around I used:
gem 'psych'
In my code before
Bundler.setup
There are two ways.
->First
add gem 'psych'
in your Gemfile file and then run
bundle install
-> Second
gem uninstall psych
at console

Resources