64

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.

user664833
  • 18,397
  • 19
  • 91
  • 140
levy
  • 833
  • 1
  • 6
  • 9

10 Answers10

92

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.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
  • 1
    I will give this a try. I just love how simple homebrew is. :D (When there are no issues) – levy May 17 '14 at 00:41
  • 2
    I had the same problem. brew upgrade ruby-build did not work. Uninstalled it (/usr/local/Cellar/ruby-build/20140225) and reinstalled it and it made no difference. I uninstalled ruby-build from brew and installed ruby-build plugin. Now I see ruby 2.1.2 available via 'rbenv install -l' – VBK Jun 02 '14 at 19:08
  • just to point out: these instructions also work with rbenv installed to a non-standard/non-homebrew location. Just change the `~/.rbenv` for your local install path (for example my machine, using boxen, puts rbenv in `/opt/boxen/rbenv`). – justin Aug 26 '14 at 17:10
  • @levy brew is easy. If you type `brew info ruby-build` then the keg info tells you to Pull. – New Alexandria Jun 26 '15 at 21:21
58

I faced the same issue. I got the latest by running the following command:

brew upgrade --HEAD ruby-build
Venkatesh Nannan
  • 1,667
  • 1
  • 15
  • 25
  • 2
    I did `brew update`and then the upgrade shown here and it worked for me. – gabe Sep 19 '14 at 20:04
  • 1
    Had this problem trying to upgrade to 2.2.2 using rbenv and it wouldn't show up on the list until I did the upgrade shown here. Regular `brew upgrade` didn't work. – Mike Grace Apr 15 '15 at 16:54
  • Originally just did a `brew install ruby` before realizing that this had no connection to the version of Ruby provided with most Apple computers. So then ran `brew uninstall ruby` followed by `brew upgrade --HEAD ruby` and things worked just fine for me! – James Sep 24 '15 at 23:00
  • 1
    This worked for me: `brew update && brew upgrade ruby-build` – racar Jul 02 '19 at 23:06
  • 1
    This worked for me HOWEVER, it complained that `--HEAD` was an invalid option. I believe this has been changed to `--fetch-HEAD`. So this worked for me: `brew upgrade --fetch-HEAD ruby-build`. After running that, I saw the version I was after (the latest). – wetjosh Apr 06 '20 at 22:42
17

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
GrahamSherry
  • 171
  • 1
  • 6
  • 1
    I installed rbenv and ruby-build with brew, and this worked to update the list of rubies in rbenv install -l include version 2.1.4 – Nate Flink Oct 29 '14 at 18:25
  • Needed this solution to update my version list for an rbenv installed under homebrew, on OSX Sierra 10.12.1. All other above solutions did not work. – Eskim0 Mar 31 '17 at 15:24
12

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)

Tomohiro Koana
  • 782
  • 1
  • 7
  • 17
  • 2
    This is the most-correct answer, as it doesn't involve anything radical. The 'git pull' command can most-normally be found by running `brew info ruby-build`. The command is printed with the keg info. – New Alexandria Jun 26 '15 at 21:20
8

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.

James Gan
  • 6,988
  • 4
  • 28
  • 36
7

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

AmitF
  • 1,287
  • 13
  • 9
5

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.

akowalz
  • 359
  • 3
  • 16
0

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.

Ismael Abreu
  • 16,443
  • 6
  • 61
  • 75
  • 1
    rbenv isn't doing anything nasty. The OP is not maintaining the code. – the Tin Man May 16 '14 at 23:30
  • if the OP updated homebew, rbenv and ruby-build and ruby 2.1.2 does not appear on the list there is something wrong for sure. And I'm saying it should be rbenv because ruby-build has the 2.1.2 version already. Probably rbenv does some sort of caching. Probably opening a new terminal window will solve the issue. – Ismael Abreu May 17 '14 at 00:19
  • Well I have rebooted and opened new terminals windows, and still do not see 2.1.2. This is so weird. – levy May 17 '14 at 00:39
  • What is also odd is that I checked on my iMac running OSX 10.8.5 and 2.1.2 is being listed in rbenv installed via brew. – levy May 17 '14 at 00:51
  • I have rbenv installed (with brew) on 3 machines - all MacOS 10.9.3. On 2 machines, 2.1.2 is listed in the rbenv install --list. On the other, it is not. ruby-build 20140524 and rbenv 0.4.0. On the problem machine, ruby-build --definitions shows 2.1.2 as available. – jmoody May 28 '14 at 09:58
  • The problem was multiple versions of ruby-build. https://github.com/sstephenson/ruby-build/issues/569 I am not sure how or when the duplicate ruby-build version was installed. – jmoody May 28 '14 at 10:15
0

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.

Andy D
  • 896
  • 7
  • 12
0

cd /home/[user]/.rbenv/plugins/ruby-build && git pull && cd -

Don't forget to replace [user] with your user

Salma Gomaa
  • 952
  • 1
  • 13
  • 18