Quiet “Don’t run bundler as root” warnings, Bundler >= 2.3.7

Why you wouldn’t want to run bundler as root

As a macOS user, you might want to be warned against running bundler as root (specifically against the system ruby), because you can cause subsequent problems for installing future gems.

The closing of issue #2936 in the rubygems/bundler project added an error message:

Don’t run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.

But what if this is deployment to a Linux machine and installing to the system ruby is your intent?

If you want to keep your logs clean of the warning message (especially if you have warnings highlighted), you can use one of the following options:

The following sets in ~/.bundle/config (/root/.bundle/config if root/sudo)

bundle config silence_root_warning true

The following can also be used if you want to temporarily disable the warning (a la “I know what I’m doing”)


As seen below using the bundle config option will fix sudo bundle install to not show the warning.

bundler as root warning

Leave a Reply

%d bloggers like this: