rbenv: You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

I’m trying to install bundler on my Mac OS Catalina, but it isn’t letting me, help

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

Update: solution is on the wiki

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 7
  • Comments: 16 (2 by maintainers)

Most upvoted comments

I had to export GEM_HOME

export GEM_HOME="$HOME/.gem"

I had to set my global ruby to the rbenv version:

rbenv global 2.6.3

wow, this probably should be in the installation instruction 😃 rbenv doesn’t install without this step on a mac today

@wilrnh Thank you for the tip. I had the same issue. Apparently, my version was set to system. Setting the global Ruby to one of the available Ruby versions in my system (i.e.: 2.7.2) fixed it for me.

Is rbenv installed on your machine? What steps have you performed for installing ruby? Can you verify if this stackoverflow answer helps.