Hi all I'm trying to set up a dev environment and I've been following a tutorial via; Link to tutorial
I'm not doing very well and have no real experience of terminal commands other than the most basic version control stuff. I followed the first link and when trying to run
source ~/.bash_profile
I got the error;
mkdir: /usr/local/rbenv/shims: Permission denied
mkdir: /usr/local/rbenv/versions: Permission denied
Now every time I load terminal the error appears.
Contents of bash_profile;
export PATH=/usr/local/rbenv/bin:$PATH
export RBENV_ROOT=/usr/local/rbenv
eval "$(rbenv init -)"
Any guidance would be greatly appreciated
It looks like the rbenv setup puts a line of shell scripting in your .bash_profile
that attempts to create that directory. You could either give yourself permissions to create directories in /usr/local/rbenv
, or sudo mkdir /directories/that/need/to/be/created
once.
sudo mkdir -p /usr/local/rbenv/shims
sudo mkdir -p /usr/local/rbenv/versions
The actual solution ;-) (without the need of changing permissions or creating directories) is to change your bash_profile
(or other like .zshrc
as in my case) and remove the two exports:
export PATH=/usr/local/rbenv/bin:$PATH
export RBENV_ROOT=/usr/local/rbenv
Start a new shell, to be sure, and execute your rbenv install <your_version_of_choice>
and it will install without any issues.
Running eval "$(rbenv init -)"
should be enough for your environment. See rbenv init explained.
I also think this is safer as you rely on the install to do it's work properly.
Gems are installed without the need of root/sudo.
This was pretty useful System Wide Install With rbenv Specifically changing the permissions of rbenv directory to a group the users are in:
chgrp -R staff /usr/local/rbenv chmod -R g+rwxXs /usr/local/rbenv
I was getting a permissions error when trying to install a ruby version.
It also was complaining that it couldn't complete the mkdir
In short set LDFLAGS to a blank string.
export LDFLAGS=
Was found here: https://github.com/rbenv/rbenv/issues/766
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With