atom-editor bundler installation macos rubygems

You don’t have write permissions for the /Library/Ruby/Gems/2.3.0 directory. (mac user)


below is what I need to do.

To run the specs, you’ll need to install RSpec. First, run gem install bundler in the root directory of your project. Then, run bundle install. To run a single spec file, run a command like this: bundle exec rspec spec/00_hello_spec.rb. To run all of the specs at once, run bundle exec rspec.

So, I typed gem install bundler in Terminal, and got the error:

You don’t have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

and this was in the project file in atom

source ""
gem "rspec", "~> 3.2.0"

My question is:

It seems like terminal is giving me the response because I’m not supposed to change anything on ruby, and I need to bundle install inside of atom? Could anyone tell me how to use atom or run anything in atom?


  • 23

    Simply use following command sudo chown -R $USER /Library/Ruby/Gems/

    Apr 4, 2021 at 12:14

  • Set global ruby version like this rbenv global 3.1.2 then it will work.

    – Sangam

    Jun 23 at 2:59


Worked for me using the parameter --user-install running following command:

gem install name_of_gem --user-install


There was one gem I still could not install (it required the Ruby.h headers of the Ruby development kit or something), then I tried the different version managers, but somehow that still did not really work as it was stated in the documentations how to just install and switch (it did just not switch the versions).
Then I removed all the installed version managers and installed afterwards with brew install ruby the latest version and did set the PATH variable, too. (It will be mentioned after the installation of ruby from brew), which worked.



    If you don’t want to run sudo then install ruby using homebrew

    brew install ruby
    export GEM_HOME="$HOME/.gem"
    gem install rails

    You may want to add export GEM_HOME="$HOME/.gem" to your ~/.bash_profile or .zshrc if you’re using zsh

    Note: RubyGems keeps old versions of gems, so feel free to do some cleaning after updating:

    gem cleanup


    • 7

      didnt help on Catalina OS 😐

      Oct 14, 2019 at 18:08

    • Rails is not currently installed on this system. To get the latest version, simply type: $ sudo gem install rails You can then rerun your "rails" command

      Oct 16, 2019 at 9:14

    • It sounds like you are trying run a rails command. The last two commands I have do not run rails command. Try to open a new terminal outside of your project then copy last two lines of my answer one by one.

      – STIKO

      Oct 16, 2019 at 21:58

    • don’t forget to source ~/. zshrc (or ~/.bash_profile)

      May 17, 2020 at 8:56

    • 1

      Working for me on Catilina 10.15.4, I did remove rvm rbenv and then installed rbenv. Then updated my .zshrc , sourced it(aka $ source ~/.zshrc) and then rails installed flawlessly. Thanks for the PATH correction.

      – Curtis M

      May 22, 2020 at 0:00