Skip to content

Instantly share code, notes, and snippets.

@gmarik
Created November 21, 2011 15:36
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmarik/1382974 to your computer and use it in GitHub Desktop.
Save gmarik/1382974 to your computer and use it in GitHub Desktop.
Disable Gem deprecation spam

How to disable Gem deprecation warnings

Just copy content to corresponding files

if [ -d "$HOME/.ruby/lib/" ]; then
RUBYLIB="$RUBYLIB:$HOME/.ruby/lib"
RUBYOPT="-rno_deprecation_warnings_kthxbye"
export RUBYLIB RUBYOPT
fi

How to disable Gem deprecation warnings

Just copy content to corresponding files

# .ruby/lib/no_deprecation_warnings_kthxbye.rb
begin
require 'rubygems'
Gem::Deprecate.skip = true if defined?(Gem::Deprecate)
rescue LoadError => e
p e
end
@Flakster
Copy link

Where should these files be created? Thanks

@golyalpha
Copy link

golyalpha commented Jun 28, 2020

@Flakster the first one would go to the end of your $HOME/.bashrc
The second one goes into $HOME/.ruby/lib/no_deprecation_warnings_kthxbye.rb

Though, to be fair, I haven't seen any change.

@gmarik
Copy link
Author

gmarik commented Jul 9, 2020

Hey, were you looking for ruby or gem deprecation warnings? This ones are for gem, and probably irrelevant nowdays.
For ruby you need

$ RUBYOPT=-W0 ruby script.rb

to disable warnings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment