Issues installing new ruby version using rbenv - ruby

I am trying to install ruby 2.5.0 on my system (macOS High Sierra) using rbenv but i'm facing a weird issue as the brew instructions are out of date:
djeustinezzz:~ JUSTINE$ rbenv install rbx-2.5.0
ERROR: Rubinius will not be able to compile using Apple's LLVM-based
build tools on OS X. You will need to install LLVM 3.5 first.
TO FIX THE PROBLEM: Install Homebrew's llvm package with this
command: brew tap homebrew/versions ; brew install llvm35
BUILD FAILED (OS X 10.13.6 using ruby-build 20160130)
The version 3.5 of LLVM was deleted. After googling here is what i've done:
brew tap homebrew/homebrew-core
brew install llvm#3.7
But nothing changed.
Homebrew, rbenv and ruby-build are installed and up-to-date.
Precision on why i'm doing this: i just installed Rails 5 on my computer and when i run the server, i have this error:
rbenv: version `ruby-2.5.0' is not installed (set by /Users/JUSTINE/desktop/code/test_five/.ruby-version)
When i run ruby -v, the output is ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17] .
Any idea?

Clone both rbenv and ruby-build using the below links
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
Now you'll have the ruby-build directory inside plugins.
cd ~/.rbenv
git pull
cd plugins/ruby-build
git pull
After this, you should 2.5.0 when you run rbenv install --list

So, what I'd do is try to see if you have the correct version of macOS command line tools installed. You could run:
xcode-select --install
Or you could start from scratch with:
rm -rf /Library/Developer/CommandLineTools
Then install the command line tools with the code above, or the better way which I found, was going directly to the Apple Developer site and downloading the command line tools package itself and installing that.
Install Command Line tools version 10.13 from here.
This issue also came up for me, but it came up when I started running Mojave. I believe it's the same thing here because I got the same errors.

Related

Need help installing Ruby 2.7.2 on Mac

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/

Updating Ruby Mac OS 10.6.8 Snow Leopard

I'm trying to install a more recent version of Ruby on Snow Leopard so I can install Jekyll. When trying to install any version of Jekyll I get an error saying that it requires liquid, which requires ruby v2+.
If I try upgrade via rbenv I get the following when trying all versions:
error: failed to download ruby-2.1.1.tar.bz2
BUILD FAILED (OS X 10.6.8 using ruby-build 20181019)
I've also installed Ruby manually from source but this isn't recognised by the system and I can't switch versions.
If i run rbenv global it only recognises the System version of Ruby.
When I try brew upgrade ruby I get the following error:
ruby 2.5.3_1 already installed
If I try link to the new version with brew I get the following error:
brew link --force --overwrite ruby#2.5.3_1
Error: No such keg: /usr/local/Cellar/ruby#2.5.3_1
RVM doesn't install so I'm not sure what to do next. Below are the details of the packages I have installed.
Xcode 3.2.2 (I cant get an installer working for any higher versions of Xcode). The more recent versions hosted by Apple for Snow Leopard are corrupt when downloaded.
rbenv 1.1.1
brew 1.8.4
ruby 1.8.7 (System)
You have (or had) a path issue. Before you did your follow up steps, if you had run which ruby you'd probably see it pointing to /usr/bin/ruby which is system ruby, not your homebrew ruby in /usr/local/bin/ruby.
You still need to, if you haven't already, add your export command to your ~/.bash_profile file to ensure your PATH gets updated for every terminal window you open.
I'm not sure what actually fixed this but I ran the following commands after reading other posts and now have Jekyll 3.8.3 installed and ruby 2.5.3p105.
sudo chown -R "$USER":admin /usr/local
export PATH=/usr/local/bin:$PATH
brew link --overwrite ruby --force
gem install jekyll

macOS Mojave 'ruby/config.h' file not found

When I try to build vim(8.1.0509) with ruby support(--enable-rubyinterp) on macOS Mojave(10.14.1) I get error:
In file included from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby.h:33:
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/ruby.h:24:10: fatal error:
'ruby/config.h' file not found
#include "ruby/config.h"
I have installed Xcode 10.1.
xcode-select -p
/Applications/Xcode.app/Contents/Developer
Note: this workaround works, but you can't just copy/paste paths blindly. Instead, look at the error installation gave you. It will say something like
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-21/2.6.0/ffi-1.15.5/mkmf.log
So open the log it mentions, and see what it can't find. It will tell you the correct versions of MacOSX__._.sdk and universal-darwin-__ you need to link
Catalina, Big Sur, etc. (As of 2020, 2021, and 2022)
UPDATE: This workaround still works as of 2022. For the commands below, please change version string (e.g., 11.1, ruby 2.6, universal-darwin20, etc.) accordingly to your macOS version environment.
Recent versions of macOS and Xcode (e.g. Catalina 10.15 and Xcode 12.2) have this broken. Reinstalling Xcode and xcode-select --install did not help for me at all (the solutions already posted seem to be outdated). I did not want to use rvm because it may cause some annoying problems.
I did a workaround by manually making a symbolic link:
cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby
ln -sf ../../../../Headers/ruby/config.h
where ruby/config.h can be found at:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby/config.h.
You should change SDK versions (e.g. 11.1 in the above example) accordingly to your current xcode installation.
It is also very likely that one runs into another error where .../universal-darwin19/ruby/config.h cannot be found (Commonmarker gem cannot be installed (needed for jekyll) macos). It can be quick-fixed as follows:
cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0
ln -sf universal-darwin20 universal-darwin19
If after using this workaround, you get a crash on pod install like:
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi/library.rb:275: [BUG] Bus Error at 0x0000000100f38000
follow this solution
macOS Catalina
Issue reappeared in Catalina and I wasn't able to spot this package in the Developer SDK. Until better solution found, I was able to workaround this with rubyenv: https://github.com/orta/cocoapods-keys/issues/198#issuecomment-510909030
brew install rbenv ruby-build
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
rbenv install 2.6.3
rbenv global 2.6.3
Mojave and older
This answer helped me: https://stackoverflow.com/a/53194299/2105993
xcode-select --install
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
On macOS Catalina
After installing and uninstalling the developer tools multiple times, this is the only thing that worked for me:
First install the Ruby Version Manager rvm:
curl -L https://get.rvm.io | bash -s stable
Then install the latest version of ruby:
rvm install ruby-2.7.2
Finally try again to install the cocoapods:
sudo gem install cocoapods
(from this answer: https://stackoverflow.com/a/65033418/3605761)
edit: may need rvm reinstall ruby-2.7.2 instead of rvm install ruby-2.7.2 at step 2.
edit2: #greg-dubicki mentioned swapping ruby-2.7.2 for ruby-3.0.3: rvm install ruby-3.0.3 and then making it the default: rvm --default use 3.0.3 they also mentioned: As an extra benefit, thanks to the switch from the outdated system Ruby 2 to a current version 3, you will get up to 3 x better performance.
I had the exact same problem. Could not install gems with native extensions. Running
$ open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
failed, because the file did not exist. Looks like Mojave can break the commandline tools.
I fixed it by removing the Xcode commandline tools, installing them again and then installing the missing headers:
$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
$ open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
If you are facing this issue in Mac Big Sur, reinstalling CommandLineTools can fix this issue.
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
This is because some versions of Xcode don't have the macOS SDK for the OS it's running on, when compiling native extension of gem.
make sure Xcode version and macOS version match each other:
macOS 10.15: Xcode < 12.2
macOS 11: Xcode >= 12.2, <= 13.0
macOS 12: Xcode >= 13.1, <= 14.0
macOS 13: Xcode >= 14.1
On macOS Catalina
If multiple versions of xcode are installed,xcode12/xcode12.4 etc.Please try to change your xcode command line tools in xcode preferences. It may works!!!
I tried all of the above and I eventually got it working with this little 'gem', pardon the pun.
sudo gem install -n /usr/local/bin cocoapods -v 1.8.4
From https://developer.apple.com/forums/thread/668456
2021 Advice
If you are able, updating to macOS Big Sur and then updating Xcode will also fix the issue.
Just tested on updating 10.15 -> 11.2.3 for macOS.
And 12.4 for Xcode.
MacOS Big Sur Beta 8
try this:
install rbenv
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
Add ~/.rbenv/bin to your $PATH for access to the rbenv command-line utility.
see: https://github.com/rbenv/rbenv#basic-github-checkout
make sure export PATH="$HOME/.rbenv/shims:${PATH}" was added to your $PATH
xcode-select --switch /Applications/Xcode.app/Contents/Develope
gem install cocoapods should work like a charm!
for me it worked "rvm install ruby" (not with brew) and then doing steps from here:
$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
and then
export PKG_CONFIG_PATH="/usr/local/opt/ruby/lib/pkgconfig"
After all this, it worked.
I did the similar things to Jongwook Choi with the following environment and problem as a case reference.
I am using macOS 12.6.2.
The problem arises when I try to install cocoapods by running sudo gem install cocoapods.
After reading the suggested logs in the terminal feedback and reading the source code it is referring to, it is obviously a bug of the builtin files in macOS 12.6.2.
In my case, I do the followings and the cocoapods can be installed successfully.
Original error
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby.h:33:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found
Action 1
The file `config.h` is missing. So I build the symbolink in the folder
cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin22/ruby/config.h
The second one is referring to a folder called universal-darwin21.
However, I try to use uname -r and got 21.6 so I think it is obviously does not hurt to create a symbolink of "universal-darwin21" to resolve the problem.
Original error
make: *** No rule to make target `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin21/ruby/config.h', needed by `AbstractMemory.o'. Stop.
Action 2
cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin22 universal-darwin21
After that, the installation runs successfully.
However, if reading the log file
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-21/2.6.0/ffi-1.15.5/gem_make.out
It is still outing some warnings, if study those warnings, will find missing folders which is obviously missing and is the problem of the system files/folders rather than anything wrong with the user actions.
My problem was different from - Yosemite upgrade broke ruby.h
As you can see in the description of the problem it's System's ruby, not Xcode's ruby so reinstall Xcode or symlink didn't help here.
Answer:
I have reinstalled macOS Mojave without losing any data and this fixed the problem.
I had a similar problem installing eventmachine 1.2.7, this worked for me (macOS 10.15.5):
(I use fish)
brew install ruby
Add the following ~/.config/fish/config.fish (without fish, just add these to path)
fish_add_path /usr/local/opt/ruby/bin
fish_add_path /usr/local/lib/ruby/gems/3.0.0/bin
set -gx CPPFLAGS "-I/usr/local/opt/ruby/include"
set -gx LDFLAGS "-L/usr/local/opt/ruby/lib"
set -gx PKG_CONFIG_PATH "/usr/local/opt/ruby/lib/pkgconfig"
sudo gem install eventmachine -v '1.2.7' --source 'https://rubygems.org/'
The set -gx commands I got after installing ruby thru brew.
I tried reinstalling the Xcode tools (12.3 as I can't upgrade to Big Sur just yet) and re-accepting agreement, but that didn't change anything
One note is that this was from installing eventmachine 1.2.7. The log error I got referenced this path as one of its flags:
-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0 -I
Note that it was trying to look in .../MacOSX11.1.sdk/..., but I have 10.15.5. Even setting CPPFLAGS, LDFLAGS, PKG_CONFIG_PATH manually did not work as I was using either system ruby or whatever rbenv had, but I was too frustrated to dig deeper down that particular rabbit hole. So, I reinstalled w/ brew's ruby!
If you're getting this error as part of bundle install, see below -
I couldn't get any of the posted solutions to work. What worked for me was installing the specified bundler version from the logs. For example, my Console was warning me about mismatching bundler version and I ran gem install bundler:2.2.32 to fix it which then fixed the bundle install command for me. In my case, i was using rvm and ruby version 3.0.0.
I ran into this after uninstalling an older version of Xcode. Typically, I install into /Applications/Xcode-13.2.1.app for example. However, xcode-select -p still showed it was pointing to an older version.
I just ran sudo xcode-select -s /Applications/Xcode-13.2.1.app and everything started working correctly again.
I cannot find this mentioned above, and I'm not sure if that's a universal solution. Mentioning this as this may be still useful.
At least with Xcode 14/macOS 13/12, it's possible to use stock Ruby, without messing up with symlinks, provided that macOS command line tools package is installed on the host. The thing is that command line tools package bundles SDKs for most recent versions of macOS, and most notably, the one matching the host (from what I can see, that SDK has the "correct" name for the directory containing ruby/config.h). Then it's just a matter of overriding SDKROOT in the environment (this is the most crucial thing), to point all the low-level tools like clang to the custom root matching the "correct" version of SDK. (Without override, it would still use the default SDK bundled with the tools, that may or not match the version of macOS running on the host).
macos_major_vers=$(sw_vers -productVersion | sed 's/^\([^.]*\)\..*$/\1/') # e.g. 12
export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX"$macos_major_vers".sdk
# ... build commands for Ruby gems go here.
I'm using rbenv (on Catalina) and none of the solutions I found here (or elsewhere) worked for me. Ultimately what fixed my environment was pointing rbenv global to a specific version of ruby instead of system:
$ rbenv global 2.6.3
This was the state of my env while gem install was failing:
$ gem env home
=> /Users/ryanc/.gem
$ which gem
=> /Users/ryanc/.rbenv/shims/gem
$ which ruby
=> /Users/ryanc/.rbenv/shims/ruby
$ ruby -v
=> ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
$ rbenv local
=> rbenv: no local version configured for this directory
$ rbenv global
=> system
$ rbenv which ruby
=> /usr/bin/ruby
The result of rbenv which ruby was the key. I decided to run rbenv global 2.6.3 and suddenly I could install gems again. Here's the new state of things:
$ ruby -v
=> ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin19]
$ rbenv global
=> 2.6.3
$ rbenv which ruby
=> /Users/ryanc/.rbenv/versions/2.6.3/bin/ruby
In my case (Catalina 10.15.7) simply re-installying ruby with homebrew fixed it. No need to install rvm or rubyenv.
it's about your ruby version or bad installation.
you can install new ruby version with rvm
first install rvm with bellow command
curl -L https://get.rvm.io | bash -s stable
then close and reopen terminal or use command source [you mac bash file like .zshrc or .bashrrc] to load rvm command
next install new ruby version with bellow command
rvm install ruby-2.7.2
now you should use new version of ruby and install last version of cocoapods
do this steps:
check ruby version
check ruby version with ruby -v command
if your ruby version not 2.7.2 use 'rvm use 2.7.2' command to switch
on new ruby
then install cocoapods with 'sudo gem install cocoapods' command
for check new pods version use 'gem which cocoapods' command.
This is not cocoa pod issue, It is related to the older version of ruby.
Simply follow the below steps :
rvm install "ruby-3.0.0"
sudo gem install cocoapods
I'm encountered with the same problem a moment ago, and the following works for me.
brew install rbenv
# To get the latest stable version of ruby
rbenv install --list
# 3.1.1 is the latest version
rbenv install 3.1.1 && rbenv global 3.1.1
Do as installation tips of the previous step:
vim ~/.zhrc and append eval "$(rbenv init - zsh)"; finally, restart your term to make the line take effect.
I prefers not to make change under /Applications/Xcode.app since everything done will be lost after upgrading Xcode.
By the way, rbenv install --list tells all stable versions of ruby, and I choose the latest. You could try earlier ruby version that works for you.

Ruby version not in ruby-build list for rbenv

I'm using Rails 4.2 and wanted to update my Ruby version as well with rbenv.
I used Homebrew to install ruby-build and no matter how many times I try to update via brew, Ruby version 2.1.3 won't show when I run rbenv install --list.
Usually, follow these steps to install a new Ruby version with rbenv:
$ brew update
$ brew upgrade ruby-build
$ brew upgrade rbenv
Check which versions are available after updating:
$ ruby-build --definitions
Install a specific version (for example 2.1.3) with:
$ rbenv install 2.1.3
Or if you are interested into improved support for UTF8 characters in the irb console:
$ RUBY_CONFIGURE_OPTS=--with-readline-dir=`brew --prefix readline` rbenv install 2.1.3
After these steps I usually set the newest version as my global default:
$ rbenv global 2.1.3
If you installed rbenv and ruby-build with homebrew and when you do echo $(rbenv root), you get /usr/local/var/rbenv instead of /Users/<username>/.rbenv, here is how to fix the issue.
When you install rbenv with homebrew, homebrew says:
To use Homebrew's directories rather than ~/.rbenv add to your profile:
export RBENV_ROOT=/usr/local/var/rbenv
Don't do that. Remove that line from your profile. Make sure you refresh your terminal after.
Then remove any signs of rbenv in the /usr/local/var directory:
sudo rm -r /usr/local/var/rbenv
Now when I do echo $(rbenv root) I get /Users/<username>/.rbenv instead of /usr/local/var/rbenv.
That fixed it for me.
The recommended installation from (https://github.com/sstephenson/ruby-build) states that you should install ruby-build as an rbenv plug-in.
I uninstalled ruby-build via Homebrew (brew uninstall ruby-build)
Navigated to ruby-build on my local machine and deleted it
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
Now, when I run rbenv install --list, I see Ruby 2.1.3. A quick installation of: rbenv install 2.1.3 and I am now free to use 2.1.3 where I like. This also worked for my teammate.
Please update by brew upgrade ruby-build and then you should see 2.1.3 in rbenv install --list
You need to update ruby build. After update you can install all current suported versions.
If you using rbenv installed via git use
cd "$(rbenv root)"/plugins/ruby-build && git pull
Or via home brew
$ brew upgrade ruby-build
$ brew upgrade rbenv

rbenv install --list does not list version 2.1.2

I installed rbenv via Homebrew on an OS X 10.9.3 MacBook Pro:
brew update
brew upgrade rbenv ruby-build
According to rbenv install --list on my laptop Ruby 2.1.0-dev is the latest.
Both rbenv and ruby-build are generally installed from Github by cloning; That's how the authors recommend we install it.
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
If you didn't do it that way I'd recommend that method. Then, you can simply do:
cd ~/.rbenv
git pull
cd plugins/ruby-build
git pull
If you have several plugins use:
cd plugins
for i in *
do
cd $i
git pull
cd -
done
I update every couple weeks just to pull in the latest fixes/changes.
I faced the same issue. I got the latest by running the following command:
brew upgrade --HEAD ruby-build
I had this issue on OS X 10.8.5 (so don't think OS related). I had tried updating rbenv & ruby-build via brew. 2.1.0-dev was still latest build available.
I had to force uninstall and re-install ruby-build via brew to fix the issue.
brew uninstall ruby-build --force
brew install ruby-build
I had the same issue. Even after running
brew upgrade rbenv ruby-build
I still didn't get ruby-2.1.2 on the available list.
Following how to update list of available ruby versions on linux, I updated ruby-build through the following commands
cd ~/.rbenv/plugins/ruby-build
git pull
(I'm using OS X 10.9.4 MacBook Air)
This happened to me today. "rbenv install -l' displays outdated list while "ruby-build --definitions" returns the correct list. The problem is fixed by executing following command:
rm -Rf ~/.rbenv/plugins/ruby-build
It seems there is an outdated version of ruby-build under ~/.rbenv/plugins. Not sure when it got generated.
This link
gives a good explanation of the two available options.
If you installed rbenv from the git repository:
$ cd ~/.rbenv/plugins/ruby-build
$ git pull
If you used Homebrew on OSX to install rbenv:
$ brew update
$ brew upgrade ruby-build
(Also running brew doctor might give you the exact solution.)
And if you have permission denied errors, this is my addition:
$ sudo chown -R $USER /usr/local; brew update
$ sudo chown -R $USER /usr/local; brew upgrade ruby-build
Then you'll be able to install the recent versions.
$ rbenv install --list
$ rbenv install 2.1.2
The selected answer will work fine, but the issue may have simply been caused by homebrew not having an up-to-date formula for ruby-build at the time. As of this posting, the appropriate ruby-build formula has been put into the latest version of homebrew. So running:
$ brew update
should get you version needed to get the latest ruby. Then, running rbenv install --list again should list 2.1.2 (and others).
So if anyone sees this later on, hopefully you can avoid having to maintain the individual repositories if you'd rather use homebrew for package management.
I've just updated ruby-build and ruby-install to latest versions and both have the latest ruby 2.1.2
Probably rbenv doing something nasty.
Following all the above, on OSX 10.11 it still wouldn't list the latest versions. What I did below worked for me- I removed the dir, re-installed from brew then I had to link in brew like this:
$ brew uninstall ruby-build --force
$ rm -Rf ~/.rbenv/plugins/ruby-build
and then
$ brew install ruby-build
$ brew link --overwrite ruby-build
and then I saw the most recent versions to build.
cd /home/[user]/.rbenv/plugins/ruby-build && git pull && cd -
Don't forget to replace [user] with your user

Resources