I can install ruby 2.6 from homebrew and I get ruby 2.6.10. How can I install ruby from Homberw with a fixed version? (Major.Minor.patch)
If I try brew install [email protected]
or [email protected]
it is not working.
I get this:
Warning: No available formula with the name "[email protected]". Did you mean [email protected]?
==> Searching for similarly named formulae and casks...
==> Formulae
[email protected] ✔
To install [email protected] ✔, run:
brew install [email protected] ✔
But I want the project to have a fixed ruby version and if that is the case with brew people wouldn't be able to install 2.6.9 anymore or 2.6.10 in the future.
BTW, It must be ruby 2.6 so don't advise upgrading, please.
CodePudding user response:
Homebrew generally uses rolling updates and always installs the newest version of a software. While it has some limited support for versioned formulas, it usually does not support this down to the exact tiny version.
So to answer your specific question about how to install a specific Ruby version with homebrew: you can't.
Instead, to install a specific Ruby version, you should use a Ruby version manager such as rbenv with ruby-build (possibly integrated into asdf), RVM, or chruby with ruby-install. All of these tools allow you to install specific Ruby versions and switch between multiple installed Rubies.
CodePudding user response:
- Enter this command in terminal
eval "$(rbenv init - zsh)"
- Install any ruby version with use rbenv - for example
rbenv install 2.7.2
- Use
rbenv global <your need version ruby >
- set global ruby version