Help installing Rails/Bundler


Hi guys.

So I’ve been having troubles with setting up this whole thing. When trying to install rails an error saying “gem command wasn’t found” kept popping up and suggested I tried sudo to install instead.

Now when trying to do install gem rails or bundle, it shows a file permission error. Has this come up to you? Haven’t found an answer on Google (I think I’m not formulating my question good enough).

Thanks in advance!


Hi @misselliev

You shouldn’t use sudo to install gems.

If you could please copy the entire error message you get then we’ll be able to assist.


I typed gem install rails and then it says:

ERROR: While executing gem… (Gem::FilePermissionError)
You don’t have write permissions for the /var/lib/gems/2.5.0 directory.


Hey @misselliev

It looks like you’ve installed rbenv using sudo which is going to cause you problems down the line.

What OS are you using?


@CouchofTomato win 10 using WSL.


What’s the output of rbenv version and ruby -v in your terminal?


For rbenv I get:
Command ‘rbenv’ not found but can be installed with sudo apt install rbenv

And for ruby -v:
Ruby 2.5.1p57 (2018-03-09 revision 63029)[x86_64-linux-gnu]


Yeah, it looks like rbenv hasn’t been installed properly.

The installations page has recently been updated to be clearer to I would go back and follow through that and ensure you get rbenv installed properly to manage your ruby versions. If you run into any issues then let us know.


Ok I’ll check it out. Thank you so much!