Rbenv: My path isn't working?

Created on 3 Oct 2016  ·  4Comments  ·  Source: rbenv/rbenv

Hi gang,

I tried to follow the guides for installing rbenv but in vain.

Conditions:
I don't have full admin rights to my Mac machine.

Steps:

  • Install rbenv.
  • Install Ruby-build.
  • Install Ruby. rbenv install 2.3.1
  • rbenv global 2.3.1

My .bash_profile:
export PATH="$HOME/.rbenv/bin:$PATH"

However when I try to run $ gem install scss_lint
It is still pointing to the system ruby path environment? Why?

$ echo $PATH
/Users/eevenn.soh/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

I can see the path is there.

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

$ gem env home
/Library/Ruby/Gems/2.0.0 <-- How to change this?

Most helpful comment

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

Okay, I have fixed it.
Need this extra one line of bad boy
eval "$(rbenv init -)" <-- If only the guide make it clearer (:

By saying: .bash_profile needs to contain:
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

All 4 comments

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

Okay, I have fixed it.
Need this extra one line of bad boy
eval "$(rbenv init -)" <-- If only the guide make it clearer (:

By saying: .bash_profile needs to contain:
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

@vennsoh Glad you solved it!

I got this too. It's confusing that running rbenv init merely gives instructions for initializing rbenv but does not actually initialize it.

On ubuntu .bash_profile isn't run. So I put those lines at the end of .bashrc:

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

and still:

pitosalas@ubuntu:~$ which ruby
/home/pitosalas/.rbenv/shims/ruby
pitosalas@ubuntu:~$ which gem
/home/pitosalas/.rbenv/shims/gem
pitosalas@ubuntu:~$ gem env home
/var/lib/gems/2.3.0
pitosalas@ubuntu:~$ 

In other words, gem's home is not set right, and so I cannot install gems without sudo (which I don't want to do.)

I know I can hack this, but I want to give working instructions to my students, so it would be great to see what I did wrong to get to this spot. Thanks!

Was this page helpful?
0 / 5 - 0 ratings