Skip to content
Latchkey

rbenv "ruby: command not found" - No Ruby Installed in CI

rbenv intercepted the ruby call through its shim but has no installed Ruby to dispatch to. The runner has rbenv set up, yet no version was ever built, so the shim resolves to nothing.

What this error means

Running ruby (or a tool that shells to it) fails with "rbenv: ruby: command not found" and a hint about installing a version. rbenv itself works; it just has no Ruby to run.

rbenv output
rbenv: ruby: command not found

The `ruby' command exists in these Ruby versions:
  (none)

Common causes

No Ruby installed under rbenv

A fresh rbenv install ships no Ruby. Until you rbenv install a version, the shim has nothing to dispatch to and reports the command as not found.

Shims not rehashed after install

After installing a Ruby (or a gem with a binary), rbenv needs rbenv rehash to regenerate shims. Without it, the executable is present but not on the shim PATH.

How to fix it

Install a Ruby and rehash

Terminal
rbenv install 3.3.0
rbenv global 3.3.0   # or rbenv local in the project
rbenv rehash
ruby --version

Prefer setup-ruby or a prebuilt image

In GitHub Actions, setup-ruby provisions a ready interpreter and avoids building under rbenv at all.

.github/workflows/ci.yml
- uses: ruby/setup-ruby@v1
  with:
    ruby-version: '3.3.0'

How to prevent it

  • Install at least one Ruby under rbenv before any ruby command runs.
  • Run rbenv rehash after installing Rubies or gems with executables.
  • Prefer setup-ruby or a base image with Ruby preinstalled in CI.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →