Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBrandon Gibbs
9,636 Points[SOLVED] rbenv global shows Ruby 2.2.3 but even after rbenv rehash, ruby -v still shows ruby 2.0.0p645
I am running OS X El Capitan.
After following the directions provided in the video, I am running into an issue.
I've run rbenv global and it shows that ruby 2.2.3 (latest stable install) is installed. However, even after running rbenv rehash, upon running ruby -v ... it says that I'm still sitting on ruby 2.0.0p645.
There was a suggestion in another question (4 months ago, so not much hope for an answer to my question within that question)... that said that in Yosemite when giving the command: echo 'if ..... at the end to replace ~/.profile with ~/.bash_profile.
Upon trying this fix, my terminal leave my prompt as just a '>' (no ' ' of course) and it will accept but will not run any commands, forcing me to close the terminal.
Any help or tips on how to resolve this would be appreciated.
1 Answer
Brandon Gibbs
9,636 PointsAfter some digging .... this is the best course of action if you are installing Ruby on a Mac (El Capitan).
brew install rbenv rub-build
# Add rbenv to bash so that it loads every time you open a terminal
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile
*** The biggest thing to note here is that after fi' ... there are TWO >> not just one, as Jason shows in the video. ***
The rest of the instructions are spot on so far. This at least got me out of that hole...
Now onward through the rest of the course.
Brandon Gibbs
9,636 PointsBrandon Gibbs
9,636 PointsI am sure that this is part of the problem...
After restarting my terminal (since the purpose of the code inserted is to execute something at terminal startup)... I get this error in my terminal. It doesn't affect any other operations... but it's obviously trying to tell me what's wrong.
-bash: evalexport PATH ="/Users/brandongibbs/.rbenv/shims:${PATH}" source "/usr/local/Cellar/rbenv/0.4.0/libexec/../completions/rbenv.bash" rbenv rehash 2>/dev/null rbenv() { typeset command command="$1" if [ "$#" -gt 0 ]; then shift fi
case "$command" in rehash|shell) eval
rbenv "sh-$command" '$@"
;; *) command rbenv "$command" "$@";; esac }: No such file or directoryThen it shows my prompt.
Any ideas on how to fix this whole thing so that there is no error...and that I have ruby properly installed...and it shows up not only after running rbenv global (which shows 2.2.3) but also shows up when running ruby -v (shows 2.0.0)?
Please don't just point me to the workshop that Jason did that is "most current". That may be the most current on here, but it's installing 2.2.1 and it's the directions that I followed to get to this spot I'm in right now.