rbenv: can't rehash, .rbenv shims exists, but it doesn't
I’m using a shared install of rbenv as per https://github.com/sstephenson/rbenv/wiki/shared-install-of-rbenv
In general, it was working, when I only had one ruby installed. But now I installed a jruby too, and have set it using rbenv shell
.
And for some reason rbenv rehash ain’t working when jruby is active.
bash-3.2$ rbenv rehash
rbenv: cannot rehash: /usr/local/rbenv/shims/.rbenv-shim exists
bash-3.2$ ls -l /usr/local/rbenv/shims/.rbenv-shim
ls: /usr/local/rbenv/shims/.rbenv-shim: No such file or directory
Any ideas of where I should start troubleshooting here?
About this issue
- Original URL
- State: closed
- Created 12 years ago
- Comments: 27 (8 by maintainers)
Commits related to this issue
- error message when rehash fails on non-writable directory Fixes #238 — committed to rbenv/rbenv by mislav 11 years ago
- error message when rehash fails on non-writable directory Fixes #238 — committed to cehoffman/rbenv by mislav 11 years ago
According to the source of rbenv-rehash, this file should only exist as long as an rbenv-rehash is running. So you can delete it if you’re positive there ain’t no rbenv-rehash running and try again.
Also seeing this problem. I’m using rbenv 0.4.0 on CentOS 6.3 in a Vagrant VM, with rbenv installed for all users (as root) in /usr/local.
rbenv rehash
will fail saying the lock file exists when it doesn’t unless the shims directory is world-writable:@lucaspottersky: Does the
/opt/rbenv/shims/.rbenv-shim
exist? Does it get fixed when you remove it?I had this same problem (also using shared install) and these steps ultimately solved the problem for me:
Making sure the ~/.profile contained the right things:
And then followed the steps from this SO answer (starting with obliterating existing folders): http://stackoverflow.com/a/11146496/21217
Actually here are the steps for posterity: