If you run ruby bundler from the command line while logged in as root, you get the following warning:
Don\'t run Bundler as root. Bundler can ask for
So I had to dig into the git log history of bundler's repo, because GitHub doesn't allow search in git commits messages anymore.
The commit c1b3fd165b2ec97fb254a76eaa3900bc4857a357
says :
Print warning when bundler is run by root. When a user runs bundle install with sudo bundler will print a warning, letting them know of potential consequences.
closes #2936
Reading this issue, you understand the real reason you should not use the root
user:
Running sudo bundle install can cause huge and cascading problems for users trying to install gems on OS X into the system gems. We should print a warning and explain that Bundler will prompt for sudo if it's needed. We should also warn people that sudo bundle will break git gems, because they have to be writable by the user that Bundler runs as.