Search code examples
ruby-on-railsrubymine

Error in first RubyMine project: "Dont run Bundler as root"


I'm trying to setup my first RubyMine project (previously I used an IDE where the environment comes fully setup for Rails).

Upon cloning a repo and opening, I'm unable to install the necessary gems, and getting an error.

40:232: execution error: 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.

Reproducing the error:

  1. There is a popup when opening the project.

RubyMine has detected that some of the gems required for 'job_tracker_1' are not installed

  1. I check run with sudo, and click install missing gems.

  2. Then I receive an error (shown above).

Alternatively:

If I run bundle in the terminal, the response is bash: bundle: command not found.

Can anyone adivse how to get around this issue?


Solution

  • There is no need to install gems with super user access that is with sudo, if necessary it might prompt for that.

    The reason is installing with sudo will install it for all users as root. If multiple people are using your machine this might cause weird behavior. Even though if you're the single user its recommended to install gems local to your home folder usually.

    Uncheck run with sudo and click install missing gems