Gem install bundler

Hello, I’m trying to run rspec on a new laptop but running into some issues.

After running gem install bundler I get

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

And after running which ruby then ruby -v I get:

ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]

I also tried reinstalling rbenv and ruby(2.3.0) but got same results.

not sure but maybe try putting sudo in the beginning i.e. "sudo gem install bundler"
Thats what I did when I faced the same problem

Please don’t use sudo. You’ll see a lot of posts on StackOverflow that suggest you use it, but doing so may mess up your system. Try this instead:

Type atom ~/.bashrc in the terminal and see if the file that opens up in Atom contains the line export PATH="$HOME/.rbenv/bin:$PATH". If it doesn’t, please add it in, restart the terminal, and see if that fixes the issue.