0

I am having some issues getting sql to work when trying to set my rails project. I have the latest version of both ruby and rails, the issue I believe lies within my terminal PATH. When typing gem install mysql, I get the following error:

ERROR: While executing gem ... (Errno::EACCES) Permission denied @ rb_sysopen - /Users/myName/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql-2.9.1/COPYING.

And when echoing my PATH I get the following description: /Users/myName/.rbenv/shims:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin This is a messed up path, and yes I have specified the PATH I want in the .bash_profile. My desired path looks like this: export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH" It just doesn't seem to work. Any ideas of what I am doing wrong? Running Sierra on a Macbook Pro 2015.

Thanks in advance for the help!

Shadow
  • 30,859
  • 10
  • 44
  • 56
user6155249
  • 119
  • 2
  • 11

2 Answers2

0

That error doesn't look like anything to do with your $PATH, which looks OK. It seems that you're trying to write to /Users/myName/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql-2.9.1/COPYING but don't have permission. Maybe you installed something as root, and now root owns the gem files.

My guess is you need to fix the ownership of your .rbenv directory.

Try sudo chown -R myName /Users/myName/.rbenv, or if you want to be more rigorous, ls -l /Users/myName/.rbenv and see what the permissions look like before fixing whichever need it.

Chris Lear
  • 6,057
  • 1
  • 14
  • 25
  • Thank you for your answer Chris. I tried using the first command you gave me and got a long list of different paths that all ended with: "Operation not permitted". So for example: chown: /Users/myName/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql-2.9.1/.gemtest: Operation not permitted – user6155249 Oct 27 '16 at 15:25
  • Then `sudo chown -R myName /Users/myName/.rbenv` – Chris Lear Oct 27 '16 at 15:26
  • I should have seen that... So this seemed to work with getting the permission out of the way. But now when trying to install mysql, "gem install mysql" I still get an error. Will try to reinstall rbenv. – user6155249 Oct 27 '16 at 15:40
  • Hello again! So I tried installing rbenv again and I get these errors: "Error: Could not link: /usr/local/etc/bash_completion.d/brew Please delete these paths and run `brew update`. Error: Could not link: /usr/local/share/doc/homebrew Please delete these paths and run `brew update`. Error: Could not link: /usr/local/share/zsh/site-functions/_brew Please delete these paths and run `brew update`. Error: Could not link: /usr/local/share/man/man1/brew." I have received these errors before and tried deleting them, ran "brew update", but now they seem to be here again. Any tips? – user6155249 Oct 27 '16 at 15:46
  • Now you're trying to alter system paths as a non-root user. Are you trying to make a system-wide installation or a personal one? If system-wide, do the whole thing as root. If personal, make sure the installation doesn't want to make links in `/usr/local/` – Chris Lear Oct 27 '16 at 15:49
  • It will be system-wide. But there seems to be a deeper underlying issue when installing rbenv. – user6155249 Oct 27 '16 at 15:51
0

Managed to solve the issue with the help of this thread: brew install mysql on mac os. And with using my brain a bit more and installing the lated command tools... Hope this can help someone else who may have forgotten Xcodes part in it all.

Community
  • 1
  • 1
user6155249
  • 119
  • 2
  • 11