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
    Big NO! never change the permission on /Library folder, the system may break in future updates. (sorry for late reply)
    Raptor
    –  Raptor
    2019-04-29 03:14:56 +00:00
    Commented Apr 29, 2019 at 3:14
  • @Raptor I'm modifying permissions on a subfolder, not "/Library". In my case, I mistakenly installed the gems as root, so I wanted to undo that. There are no negative consequences that I can think of theoretically nor have there been any that I've observed. I'm curious - why do you think this is a bad idea?
    thebiggestlebowski
    –  thebiggestlebowski
    2019-05-09 04:26:45 +00:00
    Commented May 9, 2019 at 4:26
  • The path is for system. Further updates of macOS may break.
    Raptor
    –  Raptor
    2019-05-09 04:34:54 +00:00
    Commented May 9, 2019 at 4:34
  • The gem is installed by default to this location. It was unusable because it was mistakenly installed as root (sudo) instead of my normal user. The outcome of what I did was the same as if I'd installed as $USER in the first place. I don't see the harm. Most of the other answers here suggest the same outcome/solution, but different ways to achieve it. I still don't see the problem. Are you saying gems should not be installed under /Library?
    thebiggestlebowski
    –  thebiggestlebowski
    2019-05-10 00:49:18 +00:00
    Commented May 10, 2019 at 0:49

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