Skip to content

Ruby language_version >3.4 unsupported without binaries on rvm.io #3565

@MRigal

Description

@MRigal

search you tried in the issue tracker

ruby, 3.4, ruby-build

describe your issue

I use pre-commit to run various checks on a multilanguage repo. For ruby, we run rubocop.

Until now, we had specified language_version: 3.2.2 and it worked fine.

Now we update our ruby base image to 3.4.7 and running it with language_version: 3.4.7 results in:

[INFO] Installing environment for https://github.com/rubocop/rubocop.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/bin/bash', '/Users/mrigal/.cache/pre-commit/repox33b3567/rbenv-3.4.7/bin/rbenv', 'install', '3.4.7')
return code: 2
stdout: (none)
stderr:
    ruby-build: definition not found: 3.4.7

    See all available versions with `rbenv install --list-all'.

    If the version you need is missing, try upgrading ruby-build.

It can't download the binary because RVM.io is not pushing binaries for the latest MacOS versions.

But it can't also install it because the bundled version is one year old and only contains versions up to 3.4.0-preview1. What about generating new embedded libraries or downloading ruby-build from https://github.com/rbenv/ruby-build/releases?

Best and thanks for the great tool!

pre-commit --version

4.3.0

.pre-commit-config.yaml

repos:
  - repo: https://github.com/rubocop/rubocop
    rev: v1.81.1
    hooks:
      - id: rubocop
        additional_dependencies:
          - rubocop-ast
          - rubocop-capybara
          - rubocop-factory_bot
          - rubocop-rails
          - rubocop-rspec
          - rubocop-rspec_rails
        # --force-exclusion is required as files are passed as arg/stdin and thus
        # normally overwrite the exclusion rules of rubocop.yml. This enforces exclusion
        args: [ "--config", "core/.rubocop.yml", "-A", "--force-exclusion"]
        language_version: '3.4.7'

~/.cache/pre-commit/pre-commit.log (if present)

version information

pre-commit version: 4.3.0
git --version: git version 2.50.1 (Apple Git-155)
sys.version:
    3.12.10 (main, Apr  9 2025, 03:49:38) [Clang 20.1.0 ]
sys.executable: /Users/mrigal/dev/prospect-server/dataworker/.venv/bin/python3
os.name: posix
sys.platform: darwin

error information

An unexpected error has occurred: CalledProcessError: command: ('/bin/bash', '/Users/mrigal/.cache/pre-commit/repox33b3567/rbenv-3.4.7/bin/rbenv', 'install', '3.4.7')
return code: 2
stdout: (none)
stderr:
    ruby-build: definition not found: 3.4.7
    
    See all available versions with `rbenv install --list-all'.
    
    If the version you need is missing, try upgrading ruby-build.
Traceback (most recent call last):
  File "/Users/mrigal/dev/prospect-server/dataworker/.venv/lib/python3.12/site-packages/pre_commit/languages/ruby.py", line 109, in _install_ruby
    lang_base.setup_cmd(prefix, ('rbenv', 'download', version))
  File "/Users/mrigal/dev/prospect-server/dataworker/.venv/lib/python3.12/site-packages/pre_commit/lang_base.py", line 86, in setup_cmd
    cmd_output_b(*cmd, cwd=prefix.prefix_dir, **kwargs)
  File "/Users/mrigal/dev/prospect-server/dataworker/.venv/lib/python3.12/site-packages/pre_commit/util.py", line 111, in cmd_output_b
    raise CalledProcessError(returncode, cmd, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('/bin/bash', '/Users/mrigal/.cache/pre-commit/repox33b3567/rbenv-3.4.7/bin/rbenv', 'download', '3.4.7')
return code: 1
stdout:
    Download and extract ruby 3.4.7 from the RVM repository
stderr:
    https://rvm.io/binaries/osx/26.0/arm64/ruby-3.4.7.tar.bz2 cannot be reached
    Cannot find a built version of  '3.4.7' compiled for your current system: OSX arm64 (26.0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/mrigal/dev/prospect-server/dataworker/.venv/lib/python3.12/site-packages/pre_commit/error_handler.py", line 73, in error_handler
    yield
  File "/Users/mrigal/dev/prospect-server/dataworker/.venv/lib/python3.12/site-packages/pre_commit/main.py", line 417, in main
    return run(args.config, store, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mrigal/dev/prospect-server/dataworker/.venv/lib/python3.12/site-packages/pre_commit/commands/run.py", line 442, in run
    install_hook_envs(to_install, store)
  File "/Users/mrigal/dev/prospect-server/dataworker/.venv/lib/python3.12/site-packages/pre_commit/repository.py", line 229, in install_hook_envs
    _hook_install(hook)
  File "/Users/mrigal/dev/prospect-server/dataworker/.venv/lib/python3.12/site-packages/pre_commit/repository.py", line 85, in _hook_install
    lang.install_environment(
  File "/Users/mrigal/dev/prospect-server/dataworker/.venv/lib/python3.12/site-packages/pre_commit/languages/ruby.py", line 127, in install_environment
    _install_ruby(prefix, version)
  File "/Users/mrigal/dev/prospect-server/dataworker/.venv/lib/python3.12/site-packages/pre_commit/languages/ruby.py", line 112, in _install_ruby
    lang_base.setup_cmd(prefix, ('rbenv', 'install', version))
  File "/Users/mrigal/dev/prospect-server/dataworker/.venv/lib/python3.12/site-packages/pre_commit/lang_base.py", line 86, in setup_cmd
    cmd_output_b(*cmd, cwd=prefix.prefix_dir, **kwargs)
  File "/Users/mrigal/dev/prospect-server/dataworker/.venv/lib/python3.12/site-packages/pre_commit/util.py", line 111, in cmd_output_b
    raise CalledProcessError(returncode, cmd, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('/bin/bash', '/Users/mrigal/.cache/pre-commit/repox33b3567/rbenv-3.4.7/bin/rbenv', 'install', '3.4.7')
return code: 2
stdout: (none)
stderr:
    ruby-build: definition not found: 3.4.7
    
    See all available versions with `rbenv install --list-all'.
    
    If the version you need is missing, try upgrading ruby-build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions