New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is rbenv-gem-rehash not the default? #384

Closed
gfx opened this Issue May 3, 2013 · 12 comments

Comments

Projects
None yet
7 participants
@gfx
Copy link

gfx commented May 3, 2013

Hello, thanks for this great tool and I couldn't imagine the world which lacks it.

However, there're one issue remaining: rbenv-gem-rehash is not the default.
I really really hope it is the default behavior. I have already installed it on my machine but I'd like to forget rbenv rehash completely.

@mislav

This comment has been minimized.

Copy link
Member

mislav commented May 3, 2013

I also think it's not very optimal if a user needs to remember to rbenv rehash for every new installed gem that has an executable. However, it's up to @sstephenson to decide what ships with core and what doesn't.

@sstephenson

This comment has been minimized.

Copy link
Contributor

sstephenson commented May 3, 2013

I know, it really should be the default behavior.

@gfx

This comment has been minimized.

Copy link

gfx commented May 4, 2013

Awesome. Thank you ;)

@rking

This comment has been minimized.

Copy link

rking commented May 4, 2013

Yes, and the startup time is bogged by this not being the default.

That is, if you look at the output of rbenv init -, you'll see one of the things it does is a nonbackgrounded rbenv rehash. Try running that command by itself and there's a non-trivial wait time, a time every rbenv user pays on every shell.

I vote for just switching this and taking it out of rbenv init -.

@sstephenson

This comment has been minimized.

Copy link
Contributor

sstephenson commented May 4, 2013

@rking, rbenv rehash shouldn't add more than a fraction of a second to your shell startup. Maybe you have a plugin that's slowing things down? See #304.

@mislav

This comment has been minimized.

Copy link
Member

mislav commented May 5, 2013

I'm in favor of removing rehash from rbenv init if we automatically rehash after each rbenv install and gem install. However, if other programs put their executables in Ruby's bin/, that will go undetected and the user might be frustrated that they can't use that executable through rbenv.

@mislav

This comment has been minimized.

Copy link
Member

mislav commented Oct 3, 2013

@sstephenson I can merge rbenv-gem-rehash into rbenv core, if you agree with it. It would include putting rubygems_plugin.rb somewhere in this project and changing rbenv-exec to add it to RUBYLIB.

@kevinSuttle

This comment has been minimized.

Copy link

kevinSuttle commented Nov 1, 2013

+1.

I'm actually getting an error, but only when I run it manually. I have the rbenv-gem-rehash formula installed via Homebrew.

❯ rbenv rehash
rbenv: cannot rehash: /Users/ksuttle/.rbenv/shims/.rbenv-shim exists
❯ brew cleanup
Removing: /Library/Caches/Homebrew/ruby-build-20131028.tar.gz...

~  15s
❯ brew prune
Pruned 0 dead formula
Tapped 40 formula

~  11s
❯ brew update
Already up-to-date.

~  19s
❯ brew upgrade ruby-build
==> Upgrading 1 outdated package, with result:
ruby-build 20131030
==> Upgrading ruby-build
==> Downloading https://github.com/sstephenson/ruby-build/archive/v20131030.tar.gz
######################################################################## 100.0%
==> ./install.sh
   /usr/local/Cellar/ruby-build/20131030: 89 files, 396K, built in 6 seconds

❯ rbenv rehash
rbenv: cannot rehash: /Users/ksuttle/.rbenv/shims/.rbenv-shim exists

~  7s
@mislav

This comment has been minimized.

Copy link
Member

mislav commented Nov 1, 2013

@kevinSuttle Does this only happen with rbenv-gem-rehash installed, and not without it?

The ruby-build project doesn't have anything to do with rehash. Nor does rbenv-gem-rehash affect the rbenv rehash operation in any way (it just triggers that operation after each gem install).

Can you take a look at #238 where people had a similar problem? Can you nuke the whole ~/.rbenv/shims directory and run rehash again?

@kevinSuttle

This comment has been minimized.

Copy link

kevinSuttle commented Nov 1, 2013

@mislav nuking the shims dir and rehashing seems to have fixed it. Thanks!

@konklone

This comment has been minimized.

Copy link

konklone commented Mar 12, 2014

This would be a nice thing to see drop - glad to see the issues hashed out so well so far.

@kiranos

This comment has been minimized.

Copy link

kiranos commented May 25, 2014

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment