简体   繁体   中英

rbenv local version is different than ruby -v

I apologize if I leave out any needed information, I am terrible at debugging environment errors.

Problem: I need to change my ruby version to 1.9.3, it is currently 2.0.0p247

What I tried?

I used the commands:

rbenv local 1.9.3-p448

This switched my rbenv to 1.9.3-p448 When I do ruby -v it is still 2.0.0p247

My understanding of rbenv is that when I switch it locally my ruby version should also switch to the version rbenv is on. Unfortunately this is not the case.

I am in the process of trying to look at the PATH rbenv is tied to, this is an area I really do not know much about. I have been reading other posts related to my problem but so far I haven't been able to successfully change my ruby -v.

So this was my problem.

I had a .bash_profile and a .bashrc

These settings for rbenv were in my .bash_profile

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

My PATH didn''t have the reference to shims as a result(and .rbenv/bin).

After tweaking my .bash_profile and inserting:

if [ -f ~/.bashrc ]; then
source ~/.bashrc

I then added

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

into my .bashrc

My PATH is now `PATH=/Users/me/.rbenv/shims:/Users/me/.rbenv/bin:/usr/local/share/npm/bin:/usr/local/bin:/Applications/Postgres.app/Contents/MacOS/bin:/usr/bin:/bin:/usr/sbin:/sbin

Prior to making these adjustments my PATH looked something like

'/usr/local/share/npm/bin:/usr/local/bin:/Applications/Postgres.app/Contents/MacOS/bin:/usr/bin:/bin:/usr/sbin:/sbin'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM