Skip to main content
  1. About
  2. Stack Internal
The 2026 Annual Developer Survey is live— take the Survey today!

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

How to install a gem or update RubyGems if it fails with a permissions error

I'm trying to install a gem using gem install mygem or update RubyGems using gem update --system, and it fails with this error:

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

Does anyone have an idea how to solve this?

Answer*

Reminder: Answers generated by AI tools are not allowed due to Stack Overflow's artificial intelligence policy

Draft saved
Draft discarded

Required fields are marked with *

Cancel
4
  • 1
    This didn't work for me until I ran xcode-select --install. This is required to compile extensions.
    Marc Perrin-Pelletier
    –  Marc Perrin-Pelletier
    2019-03-11 16:40:36 +00:00
    Commented Mar 11, 2019 at 16:40
  • 1
    I ran this and I want to be able to reset the changes done by these, do you know how to revert it? @Fmessina
    KarenAnne
    –  KarenAnne
    2019-10-10 03:35:07 +00:00
    Commented Oct 10, 2019 at 3:35
  • this should work: edit your ~/.bashrc or ~/.zshrc file, remove the 3 lines added, and then run again the source ~/.bashrc command
    Fmessina
    –  Fmessina
    2019-10-10 11:48:10 +00:00
    Commented Oct 10, 2019 at 11:48
  • 3
    Note that after you do this, you should use "gem install ..." instead of "sudo gem install ..." as instructed by many install guides
    sagism
    –  sagism
    2020-07-16 07:51:45 +00:00
    Commented Jul 16, 2020 at 7:51

lang-rb
Morty Proxy This is a proxified and sanitized view of the page, visit original site.