0

I am having problems installing byebug:

Errno::EACCES: Permission denied @ dir_s_mkdir -
/Users/CTO/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/byebug-5.0.0
An error occurred while installing byebug (5.0.0), and Bundler cannot continue.
Make sure that gem install byebug -v '5.0.0' succeeds before bundling.

I ran the recommended install command and got this:

Building native extensions. This could take a while...
ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ dir_s_mkdir - /Users/CTO/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/byebug-5.0.0

Help will be much appreciated

Sebastián Palma
  • 32,692
  • 6
  • 40
  • 59
  • 2
    Did you try with `sudo gem install byebug -v 5.0.0`? – Sebastián Palma May 21 '17 at 23:18
  • You may want to consider not using `sudo`. See [this](http://stackoverflow.com/questions/2119064/sudo-gem-install-or-gem-install-and-gem-locations) post which covers why using `sudo` is undesirable and some workable alternatives. – pdoherty926 May 22 '17 at 02:54

1 Answers1

0

You're getting a permission denied error when trying to install a gem in your local copy of rbenv, so I'm guessing there are some files in that directory that aren't owned by your user.

To verify this, you could run the following command to identify any files that aren't owned by your user (assuming your username is CTO):

find ~/.rbenv \! -user CTO

If that is indeed the problem, you can run the following to fix it:

sudo chown -R CTO ~/.rbenv
Adam Sheehan
  • 2,122
  • 23
  • 19