镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Macvim from Homebrew formula missing ruby@4.0 #1697

Open

Description

@Christopner

Steps to reproduce

Install macvim via homebrew via brew install macvim and then either launch the macvim via GUI or terminal. The error message I got is:

dyld[20899]: Library not loaded: /opt/homebrew/opt/ruby@4.0/lib/libruby.4.0.dylib
Referenced from: <52A6DA3C-2DB7-33B3-B925-C83D0C432B8E> /opt/homebrew/Cellar/macvim/9.2.0321/MacVim.app/Contents/MacOS/Vim
Reason: tried: '/opt/homebrew/opt/ruby@4.0/lib/libruby.4.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/ruby@4.0/lib/libruby.4.0.dylib' (no such file), '/opt/homebrew/opt/ruby@4.0/lib/libruby.4.0.dylib' (no such file)

Expected behaviour

Launch correctly

Version of MacVim

9.2.0321

MacVim installation method

Homebrew formula: brew install macvim

Environment

macOS 26.6.2

Logs and stack traces

dyld[20830]: Library not loaded: /opt/homebrew/opt/ruby@4.0/lib/libruby.4.0.dylib
  Referenced from: <52A6DA3C-2DB7-33B3-B925-C83D0C432B8E> /opt/homebrew/Cellar/macvim/9.2.0321/MacVim.app/Contents/MacOS/Vim
  Reason: tried: '/opt/homebrew/opt/ruby@4.0/lib/libruby.4.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/ruby@4.0/lib/libruby.4.0.dylib' (no such file), '/opt/homebrew/opt/ruby@4.0/lib/libruby.4.0.dylib' (no such file)

Vim and MacVim configuration where issue is reproducable

No response

How was MacVim launched?

  • by launching MacVim.app in macOS (by using the Dock, Spotlight, or the open command)
  • by running mvim/gvim in the terminal

Issue has been tested with clean configuration

  • by running mvim --clean (or gvim, supplied by MacVim distribution). You can also use the File → "New Clean Window" menu item within MacVim.
  • by running vim --clean (in terminal, supplied by MacVim distribution)
  • by running vim --clean (in terminal, other suppliers, e.g. /usr/bin/vim)

Activity

  1. eirnym commented on Aug 31, 2026

    @eirnym
    Contributor

    You always can put correct path for ruby interpreter via a setting in a MacVim's (g)vimrc.

  2. Pluies commented on Sep 8, 2026

    @Pluies

    I ran into the same issue and tried setting the interpreter via ~/.vimrc as:

    set rubydll=/opt/homebrew/opt/ruby/lib/libruby.4.0.dylib
    

    But it did not work.

    Instead, I symlinked the necessary ruby dylib from the ruby installed by homebrew:

    mkdir -p /opt/homebrew/opt/ruby@4.0/lib
    ln -s /opt/homebrew/opt/ruby/lib/libruby.4.0.dylib /opt/homebrew/opt/ruby@4.0/lib/libruby.4.0.dylib
    

    It's ugly, but it works 🤷

  3. chache17 commented on Sep 18, 2026

    @chache17

    Instead, I symlinked the necessary ruby dylib from the ruby installed by homebrew:

    mkdir -p /opt/homebrew/opt/ruby@4.0/lib
    ln -s /opt/homebrew/opt/ruby/lib/libruby.4.0.dylib /opt/homebrew/opt/ruby@4.0/lib/libruby.4.0.dylib
    

    It's ugly, but it works 🤷

    This worked for me. Thanks a lot.

  4. eirnym commented on Sep 19, 2026

    @eirnym
    Contributor

    It's worth a while to look into formula as I don't see such messages from the GitHub release.

    My guess, formula changes from dynamic library linking to static, and Homebrew build environment is different from actual run environment.

    I personally don't use Homebrew, so I can't check if dynamic library for the GitHub release is loading correctly.

  5. Mizux commented on Sep 23, 2026

    @Mizux

    A little bit more cleaner, regenerate the ruby@4 symlink using:

    brew unlink ruby && brew link ruby

    ref: https://github.com/orgs/Homebrew/discussions/7041#discussioncomment-18209263

  6. erikdw commented on Sep 29, 2026

    @erikdw

    This is fixed on the Homebrew side by Homebrew/brew#24113 (merged 2026-09-29). MacVim is fine: its bottle links /opt/homebrew/opt/ruby@4.0/lib/libruby.4.0.dylib because that is the install name the ruby formula publishes. brew upgrade ruby was deleting the opt/ruby@4.0 alias while uninstalling the previous keg.

    The fix is on Homebrew's main branch. It is not in the 7.0.7 release, so brew update is what picks it up.

    Two cases:

    1. Ruby was already upgraded or reinstalled on a Homebrew from before that fix, so opt/ruby@4.0 is already gone. Updating Homebrew does not recreate it. Run this once:

      brew unlink ruby && brew link ruby

      MacVim starts again. Later Ruby upgrades keep the alias, as long as Homebrew includes the fix.

    2. Homebrew is updated to a version that includes the fix while opt/ruby@4.0 still exists. A later brew upgrade ruby leaves that alias in place, so MacVim keeps working with no extra step.

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