rbenv install --list does not list version 2.1.2 - ruby

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

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/

Issues installing new ruby version using rbenv

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.

I can't uninstall Git

I tried to update my git version on Mac OS X 10.7, but it doesn't change the version.
It's still on 2.0.
If I run,
rm -rf /usr/local/git
rm /etc/paths.d/git
rm /etc/manpaths.d/git
the new version gets uninstalled, but the old one is still there (git is still a valid command).
How can I find the directory where this "ghost" version is installed?
To see where git is installed:
which git
See for instance those guides:
"Beginner's Setup Guide for Git & Github on Mac OS X"
"Install and Update to latest version Git on Mac OSX 10.10 Yosemite"
The location usually is:
/usr/local/git/bin/git
As mentioned in "Can't seem to uninstall git":
/opt/local/bin is the location of software installed by macports, so you'll want to run this:
sudo port uninstall git
If you see /usr/local/bin/git, that is likely a brew installation: see "Can't use homebrew installed git":
brew uninstall git
# make sure everything is alright, maybe brew will give you some hint
brew doctor
brew update
brew install git
# magic happen, brew will give you hint /usr/bin occurs before /usr/local/bin
# and recommend you run following command
brew doctor
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile

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

The command rbenv install is missing

In Ubuntu 10.04 I just installed rbenv.
The install command is not present.
rbenv 0.4.0-49-g8b04303
Usage: rbenv <command> [<args>]
Some useful rbenv commands are:
commands List all available rbenv commands
local Set or show the local application-specific Ruby version
global Set or show the global Ruby version
shell Set or show the shell-specific Ruby version
rehash Rehash rbenv shims (run this after installing executables)
version Show the current Ruby version and its origin
versions List all Ruby versions available to rbenv
which Display the full path to an executable
whence List all Ruby versions that contain the given executable
See `rbenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/sstephenson/rbenv#readme
What am I missing?
The install command is not embedded into rbenv, it comes from the ruby-build plugin. You can install it using the command:
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
On Mac OS X you can install it through homebrew:
brew install ruby-build
On Debian (version >= 7) and Ubuntu (version >= 12.10) both rbenv and ruby-build can be installed using apt-get (or aptitude):
sudo apt-get update
sudo apt-get install rbenv ruby-build
On FreeBSD ruby-build is available in the Ports Collection, it can be install both as a binary package or build from the port:
# Using pkgng rbenv will be installed
pkg install ruby-build
# Building ruby-build form Ports will install rbenv only if the RBENV option is set
cd /usr/ports/devel/ruby-build
make install
I found that when using rbenv from a global directory, it's necessary to export the RBENV_ROOT variable, otherwise it won't load the plugins.
export RBENV_ROOT="/usr/local/rbenv"
if [ -d "${RBENV_ROOT}" ]; then
export PATH="${RBENV_ROOT}/bin:${PATH}"
fi
As everyone mentioned problem is missing ruby-build. For older versions of OS ruby-build may not be available as an apt package. In that case install using original instructions, which should've omitted the word Optional in this:
(Optional) Install ruby-build, which provides the rbenv install
command that simplifies the process of installing new Ruby versions.
git clone git#github.com:rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
# OR use http
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
Simply install ruby-build in ubuntu:
sudo apt-get install ruby-build
And add
eval "$(rbenv init -)"
To your ~/.bashrc
I had installed the ruby-build plugin before and installed ruby 1.9.3-p327 using
$ rbenv install 1.9.3-p327
A few days later I tried to install ruby 2.0.0-p247 using
$ rbenv install 2.0.0-p247
but I received the error message
rbenv: no such command 'install'
All I had to do was to run
$ exec $SHELL -l
and that fixed the problem.
Answered on 2021
If you're getting that error, it's very likely you have accidentally skipped one of the installation instructions:
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
Replace .bashrc with whatever shell you're using, for example .zshrc, or just manually access your shell config file and paste this line:
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
I strong advise against re-installing/installing Ruby via brew or apt-get just to get around this issue. The whole point of using rbenv is to make your life easier in future when there is ruby version upgrade, or when you're working on different rails projects that require different version of ruby.
It looks like ruby-build is not present. Run this command :
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
Anyone finding their way here with this issue on OSX and already having installed ruby-build via homebrew (like me), you may solve this by just upgrading ruby-build:
brew update
brew upgrade ruby-build
This fixed the problem for me.
This issue also happens in Linux when doing a stand-alone installation of ruby-build, if the ruby-build executable is not found in the path. If installing under /usr/local, try for example:
PATH=/usr/local/bin:$PATH /usr/local/bin/rbenv install ...
I came to this solution, but looking for a macOS solution that uses MacPorts.
So, here the same command using MacPorts:
➜ ~ sudo port install ruby-build
Password:
---> Computing dependencies for ruby-build
---> Fetching archive for ruby-build
---> Attempting to fetch ruby-build-20210804_0.darwin_19.noarch.tbz2 from https://packages.macports.org/ruby-build
---> Attempting to fetch ruby-build-20210804_0.darwin_19.noarch.tbz2.rmd160 from https://packages.macports.org/ruby-build
---> Installing ruby-build #20210804_0
---> Activating ruby-build #20210804_0
---> Cleaning ruby-build
---> Scanning binaries for linking errors
---> No broken files found.
---> No broken ports found.
➜ ~ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
Checking for `rbenv' in PATH: /opt/local/bin/rbenv
Checking for rbenv shims in PATH: OK
Checking `rbenv install' support: /opt/local/bin/rbenv-install (ruby-build 20210804)
Counting installed Ruby versions: none
There aren't any Ruby versions installed under `/Users/user/.rbenv/versions'.
You can install Ruby versions like so: rbenv install 3.0.2
Checking RubyGems settings: OK
Auditing installed plugins: OK
➜ ~ rbenv install 3.0.2
Downloading openssl-1.1.1k.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5
Installing openssl-1.1.1k...

Resources