Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: rbenv rehash not working (rbenv-shim exists)

I am trying to rehash rbenv after installing a new gem it gives me these error on my ubuntu server

 rbenv: cannot rehash: /home/deployer/.rbenv/shims/.rbenv-shim exists

however .rbenv-shims doesn't exists

like image 272
Remon Amin Avatar asked Dec 03 '14 16:12

Remon Amin


People also ask

What is shims rbenv?

Shims are lightweight executables that simply pass your command along to rbenv. So with rbenv installed, when you run, say, rake , your operating system will do the following: Search your PATH for an executable file named rake. Find the rbenv shim named rake at the beginning of your PATH.

How does rbenv work?

First, rbenv creates shims for all the commands ( ruby , irb , rake , gem and so on) across all your installed versions of Ruby. This process is called rehashing. Every time you install a new version of Ruby or install a gem that provides a command, run rbenv rehash to make sure any new commands are shimmed.

What is rbenv in Ruby?

rbenv is included in all installations of Bitnami Ruby stack that use system packages. It is a command-line tool which allows you to easily install, manage, and work with multiple Ruby environments. Every installed Ruby interpreter using rbenv is isolated in its own directory with its libraries and gems.


1 Answers

Might be an issue with directory permissions @ sstephenson/rbenv:

FWIW - I also had this problem, and had to change permissions on the dir where it was checking for the .rbenv-shim... so it could write to the dir, so it stopped complaining.

Also, try:

rm /home/deployer/.rbenv/shims/.rbenv-shim

and run:

rbenv rehash
like image 195
rebelshrug Avatar answered Sep 16 '22 15:09

rebelshrug