rbenvでrubyをインストールしたら、「rbenv: cannot rehash: /Users/Username/.rbenv/shims/.rbenv-shim exists」と言われた

エラー発生

$ rbenv install 2.1.2 
Downloading ruby-2.1.2.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/a5b5c83565f8bd954ee522bd287d2ca1
Installing ruby-2.1.2...
Installed ruby-2.1.2 to /Users/Username/.rbenv/versions/2.1.2

rbenv: cannot rehash: /Users/Username/.rbenv/shims/.rbenv-shim exists

こんな感じのエラー発生。

解決方法

$ gem install bundler
Fetching: bundler-1.6.5.gem (100%)
Successfully installed bundler-1.6.5
1 gem installed

$  mv /Users/Username/.rbenv/shims/.rbenv-shim /Users/Username/.rbenv/shims/.rbenv-shim2

$ rbenv rehash

一応gemをインストールして、名前を変えて解決。

参考