Skip to content
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

Avoid an installation if the requested ruby is already installed #266

Open
ferrarimarco opened this issue Apr 5, 2016 · 8 comments
Open

Comments

@ferrarimarco
Copy link

Currently I am running ruby-install ruby x.x.x to install Ruby as a non privileged user.

If I run the same command again with the same user, ruby-install does not check if the package is already installed, but installs it one more time, leading to a waste of time.

@postmodern
Copy link
Owner

There is a --no-reinstall flag, or do you want --no-reinstall to be the default behavior?

@havenwood
Copy link
Collaborator

@ferrarimarco Sometimes folk build the same version once again but differently.

@ferrarimarco
Copy link
Author

@postmodern I didn't notice the flag. Is there any documentation? Maybe it could be useful to have a --force-reinstall flag and the --no-reinstall be the default, like other package managers do, like pip for example.

@havenwood I think it's a bad practice so it should not be encouraged.

@havenwood
Copy link
Collaborator

@ferrarimarco What's bad practice about rebuilding the same version with different build options? Say for example you want to rebuild 2.3.0 with tail call optimization or whatever else?

@ferrarimarco
Copy link
Author

@havenwood I misunderstood your first answer. This is a perfectly fine use case.

@todd-a-jacobs
Copy link

I came to this thread because I was surprised to find that ruby-install --update ruby will (by default) reinstall the current version even if it's already the latest version. I'm also currently looking through the code to see if YJIT is currently enabled by default for later versions. It's also a little unclear whether build options passed are preserved if the -c flag is passed to ruby-install as that cleans up the build directory.

I wrote a Fish function this morning that checks the current Ruby version against the latest stable builds as reported by ruby-install, and then calls ruby-install with some hard-coded defaults and updates ~/.ruby-version with the latest C Ruby. This is probably not what everyone wants, so I'm not proposing it as a solution. I'm just suggesting that a recompilation of an existing Ruby by default is not what most people intend when they "upgrade."

Even if nothing else changes, I think "--reinstall" or "--recompile" should be non-default options, while "--no-reinstall" should be the default behavior. Especially when upgrading libraries, a deliberate recompile can make sense, but reinstalling from scratch by default wastes CPU cycles that likely aren't intended. Just my $0.02 regarding my own personal experience; other use cases may vary.

@todd-a-jacobs
Copy link

There is a --no-reinstall flag, or do you want --no-reinstall to be the default behavior?

If it’s an option, I think not reinstalling should be the default behavior. A reinstall or rebuild flag could enable recompiling when someone really wants to make changes such as rebuilding with YJIT enabled/disabled. I doubt rebuilding is what most people intend as the default use case when running a bare install, though, unless Ruby-install is caching build options and detects a change.

@postmodern
Copy link
Owner

Should --no-reinstall be the default behavior (i.e. not installing the same ruby into the same location twice)?

@postmodern postmodern self-assigned this Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants