How to hide Ruby 2.7 deprecation warnings system-wide

svyatov

Leonid Svyatov

Posted on April 24, 2020

How to hide Ruby 2.7 deprecation warnings system-wide

Are you using rbenv? Want to hide Ruby 2.7 deprecation warnings system-wide and not to deal with it on a per-project basis? This small tutorial is for you!

All you have to do is create file ~/.rbenv/rbenv.d/exec/hide-deprecations-for-2.7.bash with the following content:

# ~/.rbenv/rbenv.d/exec/hide-deprecations-for-2.7.bash

if [[ ${RBENV_VERSION%.*} == '2.7' ]]; then
  export RUBYOPT="-W:no-deprecated -W:no-experimental"
else
  unset RUBYOPT
fi
Enter fullscreen mode Exit fullscreen mode

Done.

How exactly does it work can be found here.

I've tested it in Zsh. It should work in Bash, but I can't guarantee it.

💖 💪 🙅 🚩
svyatov
Leonid Svyatov

Posted on April 24, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related