0

I am trying to update my Ruby version with my rbenv and am having trouble installing 2.1.1. I have followed the instructions carefully but it does not seem to be working for some reason. Please let me know what I am doing wrong.

Installed ruby-2.1.1 to /Users/user/.rbenv/versions/2.1.1  
$ 
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
$ rbenv rehash
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
$ rbenv global 2.1.1
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
$ rbenv global 2.1.1
$ rbenv rehash
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
$ rbenv local 2.1.1
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
$ rbenv versions
system
* 2.1.1 (set by /Users/user/.ruby-version)
$ rbenv global 2.1.1
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
$ 

Any thoughts on what's going on?

not sure if this helps get to the root of the issue..

PATH=usr/local/bin:/urs/local/sbin:/usr/local/mysql/bin:usr/local/bin:/urs/local/sbin:/usr/loca        /mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
\$ ~/.bash_profile
-bash: /Users/user/.bash_profile: Permission denied
$ ~/.bash_profile
-bash: /Users/user/.bash_profile: Permission denied
$ export PATH="$HOME./rbenv/bin:$PATH"
$ "$(rbenv init -)"
-bash: export PATH="/Users/user/.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 directory
keepcoding
  • 15
  • 6

1 Answers1

3

Sigh... first, take a close look at your path:

PATH=usr/local/bin:/urs/local/sbin:/usr/local/mysql/bin:usr/local/bin:/urs/local/sbin:/usr/loca        /mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

You have multiple definitions for the same directories, and, in addition have what are very likely invalid directory names:

  • usr/local/bin should be /usr/local/bin. usr/local/bin is a relative directory name, which would usually be invalid anywhere unless you're in your / directory. This is in the path multiple times, so remove all but the middle one and fix the name.
  • /urs/local/sbin is probably a misspelled directory /usr/local/sbin, but, at the same time, you probably shouldn't have a .../sbin directory in your path because you'll seldom use the files in there. That particular directory is in your path twice, so remove at least one.
  • /usr/loca /mysql/bin is totally invalid so remove it. If you are using MySQL, then fix that entry; It's probably /usr/local/share/mysql/bin, but confirm that and adjust as necessary.

You're using

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

which is not a valid definition for PATH. $HOME would normally look like /home/user, without a terminating or delimiting /. Using $HOME./rbenv... would result in /home/user./rbenv... which isn't valid.

rbenv needs a chance to initialize when your shell session starts. To do that it expects you to add

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

to your ~/.bash_profile file as the very last lines. It's obvious that hasn't been done because your path would reflect that if it had. Mine starts with a reference to rbenv's shim, then bin directories.

I have followed the instructions carefully but it does not seem to be working for some reason.

I'd strongly recommend you read the rbenv documentation for setting it up.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
  • Just be careful messing with the path. A simple slip and you can make it so your machine won't find anything when you're at the command prompt, and, if you don't know your way around (which I suspect is true because of the mistakes you made) you'll have a really hard time getting it fixed. – the Tin Man Mar 15 '14 at 19:16