Search code examples
rubyterminalrbenv

rbenv installation permission denied


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


Solution

  • 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