Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

rbenv works but rbenv install is not a command

Errorrbenv install does nothing or is not recognised as a command

Short answer

rbenv itself does not build Ruby. The install command comes from the ruby-build plugin, which lives in rbenv's plugins folder. If that plugin is missing, in the wrong folder or old, rbenv install is missing or does not know a new version. Clone ruby-build into the plugins directory, or update it.

  • Applies to rbenv 1.3, ruby-build 20xx, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Ask rbenv where it lives and which plugins it can see.

    rbenv root
    ls "$(rbenv root)/plugins"
  2. 2Match what you see, then jump to its fix

    1. 1The plugins folder is empty or does not existThe ruby-build plugin was never installedFix
    2. 2ruby-build exists on disk, but not under the path printed by rbenv rootThe plugin is in the wrong folderFix
    3. 3rbenv install works, but the version you ask for is not in the listThe plugin is too old to know the Ruby version you wantFix

What does the error look like?

  • rbenv install does nothing or is not recognised as a command
  • the newest Ruby version is not in the rbenv install --list output

Cause 1 of 3

The ruby-build plugin was never installed

1Check

rbenv from a git checkout does not include ruby-build. The rbenv README says to install the plugin if the install command is missing.

ls "$(rbenv root)/plugins/ruby-build"

2Fix

Clone ruby-build into rbenv's plugins directory. With Homebrew, use brew install ruby-build instead.

git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build

3Verify

The command should now be known and list versions.

rbenv install --list

Confirmed by github.com

Did this fix it?

Cause 2 of 3

The plugin is in the wrong folder

1Check

rbenv only loads plugins from the plugins directory under its own root. A clone in your home folder or beside rbenv is not picked up. Compare the two paths.

rbenv root
find ~ -maxdepth 4 -type d -name ruby-build 2>/dev/null

2Fix

Move the clone to the plugins directory of the root that rbenv reports.

mkdir -p "$(rbenv root)/plugins"
mv ~/ruby-build "$(rbenv root)/plugins/ruby-build"

3Verify

Check the command again.

rbenv install --list

Confirmed by github.com

Did this fix it?

Cause 3 of 3

The plugin is too old to know the Ruby version you want

1Check

ruby-build ships one definition file per Ruby version, so a new Ruby release is not offered until ruby-build itself is upgraded.

rbenv install --list | tail -n 5

2Fix

Update the plugin: git pull in its folder, or brew upgrade ruby-build with Homebrew.

git -C "$(rbenv root)"/plugins/ruby-build pull

3Verify

List the versions again, then install the one you want.

rbenv install --list
rbenv install 3.4.1

Confirmed by github.com

Did this fix it?

How do I stop it coming back?

  • Install rbenv and ruby-build together, and note both in your machine setup script.
  • Update ruby-build before you install a new Ruby version.
  • Install build tools and development headers before running rbenv install; ruby-build does not check most of them. Its wiki lists the suggested build environment.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Related fixes

Servers

dnf cannot install MySQL on Amazon Linux 2023

dnf cannot find a mysql-server package on Amazon Linux 2023

Amazon Linux 2023 documents MariaDB, not MySQL, as its database server, with packages named mariadb105 and mariadb105-server.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.