I have an existing version of openssl installed, however its the old version. Upgrading to new releases of Ruby, using rbenv, does not upgrade openssl.
How do I force rbenv to upgrade?
This is under ubuntu 10.
rbenv is not a package manager. This is a good thing.
If you want to use a newer version of openssl, simply specify it when you compile ruby
$ ./configure --prefix=$HOME/.rbenv/versions/2.0.0-p247 --with-opt-dir=/usr/local/opt/openssl --enable-shared
To see more help, use $ ./configure --help
If you're using rbenv ruby-build plugin, you can use CONFIGURE_OPTS
$ CONFIGURE_OPTS="--with-opt-dir=/usr/local/opt/openssl" rbenv install 2.0.0-p247
Read more about Special Environment Variables for ruby-build
Related
I had problems installing ruby with rbenv so I installed it with Homebrew.
The problem is that I still want to manage this ruby version with rbenv.
How can I do that?
Let's say you installed ruby 2.7 (brew does not let you choose patch version): brew install ruby#2.7.
We will call this version 2.7-brew in rbenv but you can call it whatever you like (for example 2.7). Just change all pathes in this answer from 2.7-brew to 2.7 or to another name.
We want rbenv to manage this ruby version:
cd ~/.rbenv/versions
mkdir -p 2.7-brew/bin
We need to link our newly installed ruby version:
replace <Installed Version> with the version brew installed (probably 2.7.7 or a greater patch version)
If you don’t know the version or the installation directory run:
brew info ruby#2.7
Link this ruby version to the directory we have created:
On Mac computers with apple silicon (M1).
ln -s /opt/homebrew/Cellar/ruby#2.7/<Installed Version>/bin/ruby 2.7-brew/bin/ruby
On Mac computers with amd64 architecture (Intell).
ln -s /usr/local/Cellar/ruby#2.7/<Installed Version>/bin/ruby 2.7-brew/bin/ruby
Let rbenv know that we added a new ruby version:
rbenv rehash
Now, rbenv should be able to use this new ruby version.
I'm trying to install Ruby version 2.7.2 on my Mac (latest OS with all updates) and did the following
brew update
brew upgrade rbenv ruby-build
and then
rbenv install 2.7.2
ruby-build: definition not found: 2.7.2
See all available versions with `rbenv install --list'.
If the version you need is missing, try upgrading ruby-build:
brew update && brew upgrade ruby-build
So I tried following the instructions above and get this
brew update && brew upgrade ruby-build
Already up-to-date.
Warning: ruby-build 20200926 already installed
You need to install the latest ruby-build
$ brew unlink ruby-build # remove STABLE version
$ brew install --HEAD ruby-build
$ rbenv install -l | grep '2.7.2'
2.7.2
Only latest stable releases for each Ruby implementation are shown.
Use 'rbenv install --list-all' to show all local versions.
The answer from #andrei-kovrov is correct but, alternatively, you can wait until this PR gets merged:
https://github.com/Homebrew/homebrew-core/pull/62096
Btw, this answer will not age well so, for reference, this is where the formulae are staged before they get released:
https://github.com/Homebrew/homebrew-core/pulls
It might be an issue reading the correct version of ruby based on the path that is specified. If you already have another version of ruby installed the path might not be updated to look for a newer version.
This article has a lot of really great information on how to set up ruby on a mac:
https://stackify.com/install-ruby-on-your-mac-everything-you-need-to-get-going/
Using brew I go though the normal install process to get rbenv and Ruby installed.
Everything goes smoothly but it is soon apparent Ruby did not install with openssl onboard.
The only thing that seems to allow rbenv to auto install openssl during the ruby install is to use this:
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include /usr/include
Is this a bug in rbenv or brew that needs fixing?
There's a long thread about rbenv with openssl on Github here
The easiest way to fix it are:
1) Update to the latest version of rbenv where they fixed the CONFIGURE_OPTS options, then delete and re-build all your ruby versions.
2) Use the older version of rbenv and explictly set the CONFIGURE_OPTS to use the brew openssl:
CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install <whatever version you need>
I have some issues with upgrading my Ruby version with RVM on OS X.
RMV uses MacPorts, causing me to run sudo port selfupdate, which gets a bunch of compiling errors, despite correct Xcode command line tools installed.
I found some installation instructions using Linux apt-get but unfortunately I don't have in it on my Mac.
I want to install Ruby without RVM. How can I do that?
In case Macports does not work for you, try Homebrew:
rvm autolibs homebrew
Please note: Although it is not required, you might want to install Homebrew before using it with autolibs. It keeps Homebrew out of RVM directories.
Using Homebrew, you can either install and manage a single version of Ruby:
brew update
brew install ruby
Or, even better, use rbenv as a flexible alternative to RVM:
brew update
brew install rbenv
brew install ruby-build
rbenv install 2.0.0-p247
rbenv rehash
rbenv then makes it easy to use a specific version of Ruby either globally or per project (which can then be added to source control).
Note that you may want to follow the advice from rbenv's "caveats" (brew info rbenv), particularly the part about adding eval "$(rbenv init -)" to your profile.
I have installed rbenv in my vagrant machine but when I try to list all the available ruby versions rbenv versions then it gives me this output:
system (set by /home/vagrant/.rbenv/version)
Does anyone know what is this?
Are you asking what the output of that command means? I'm looking at the rbenv documentation, and I think it indicates that rbenv only knows of one version of ruby - the version that came installed with your system.
Edit: If that's not the answer you were looking for, can you tell us what you expected to see? Did you have other versions installed on that machine?
Edit 2: If you want to see a list of versions you can install onto your machine, but aren't installed yet, run:
rbenv install --list
Here is more documentation for this command. This will help!
If you have tried both rbenv install --list and ruby-build --definitions and still can't see the latest Ruby versions on the list, then you need to upgrade ruby-build because that is what rbenv uses to "know" the available versions.
For example, assuming you use Mac OS X and installed ruby-build using Homebrew, you can update ruby-build by invoking:
brew upgrade ruby-build
Now, try listing the available versions again, and you should see the latest ones there.
Edit:
The ruby-build wiki lists a couple of ways of updating it, namely the above one using Homebrew and another one where it is installed as a plugin to rbenv:
cd "$(rbenv root)"/plugins/ruby-build && git pull
Rbenv is usually installed with it's companion ruby-build
You can get the versions available to be installed with:
ruby-build --definitions
To get a list of available ruby versions you can install, type the following:
rbenv install -l
To get a list of the ruby versions already installed on your machine, type the following:
rbenv versions
To answer your question as to what the below means:
system (set by /home/vagrant/.rbenv/version)
This is telling you that the system ruby (the default ruby installed on your system) is the only ruby version installed on your vagrant machine. Rbenv is using the default system ruby because it doesn't have any other ruby versions installed yet.
To see all available versions:
rbenv install --list-all
Or
rbenv install --list
To list only stable releases for each Ruby implementation.
If you are on Mac
brew upgrade rbenv ruby-build also works.
Documentation
List rbenv versions that are possible to install
"Only latest stable releases for each Ruby implementation are shown.
With the fewest key strokes (shorter than --list and --list-all)
rbenv install -l
Want to see what is available from rbenv to install?
ruby-build --definitions
Want to narrow that down a bit?
ruby-build --definitions | grep 3.0
To upgrade to the latest rbenv and update ruby-build with newly released Ruby versions, upgrade the Homebrew packages:
brew update && brew upgrade rbenv ruby-build
Also you can always just type rbenv
Which will give you a help menu
rbenv
TLDR the manpage or github repo or just plain forgot?
Take a peek at this site for quick rbenv recollection:
https://devhints.io/rbenv
Also, you may need to brew upgrade if you have installed with brew see here.