Skip to content

gem update fails on 4.0.9: minitest binstub not patched for RubyGems overwrite detection #80

Done

Description

@ArloL

What were you trying to do when you hit this?

Updating my installed gems with gem update.

What you ran

gem update on Ruby 4.0.9 (ruby-4.0.9.macos.tar.gz), installed via mise 2026.11.14 on macOS 27.2.1 arm64.

What happened

minitest's executable "minitest" conflicts with .../installs/ruby/4.0.9/bin/minitest
Overwrite the executable? [yN]
ERROR:  Error installing minitest:
        "minitest" from minitest conflicts with .../installs/ruby/4.0.9/bin/minitest

minitest stays at the bundled 6.0.0. I expected it to update to 6.1.0. gem update rake on the same install works.

Version

Ruby 4.0.9, macOS arm64

Cause and fix

This is the same RubyGems overwrite detection that #6 fixed for rbs. patch_executables only matches #!/usr/bin/env ruby, but minitest 6, which is bundled from Ruby 4.0, starts its executable with #!/usr/bin/env -S ruby. Its binstub is never patched.

PRs are limited to collaborators, so the fix is on my fork: ArloL@63e57f3

  • Match any Ruby shebang (^#!.*ruby.*\n) when adding the RubyGems marker.
  • Add a runtime check that reinstalls every bundled gem with an executable from its cached .gem (offline). A binstub RubyGems won't overwrite now fails the build.

On the 4.0.9 macOS release tarball, the new check fails at minitest on the released binstubs and passes after the fix. With the marker stripped from all stubs (the #6 bug), it fails at bootsnap.

I hit this during a routine gem update. Claude Code helped me trace the cause and write the fix.

Activity

  1. added a commit that references this issue on Nov 24, 2026
  2. added a commit that references this issue on Nov 27, 2026
    b0d744b
  3. github-actions commented on Nov 27, 2026

    @github-actions
    Contributor

    Fixed in 4.0.9-2 by #82.

  4. github-actions commented on Nov 27, 2026

    @github-actions
    Contributor

    Fixed in 4.0.10-2 by #82.

  5. github-actions commented on Nov 27, 2026

    @github-actions
    Contributor

    Fixed in 4.0.8-2 by #82.

  6. github-actions commented on Nov 27, 2026

    @github-actions
    Contributor

    Fixed in 4.0.7-3 by #82.

  7. github-actions commented on Nov 27, 2026

    @github-actions
    Contributor

    Fixed in 4.0.5-5 by #82.

  8. github-actions commented on Nov 27, 2026

    @github-actions
    Contributor

    Fixed in 4.0.4-6 by #82.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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