DEV Community

Leonid Svyatov
Leonid Svyatov

Posted on

2

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.

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more