Brew: Broken vim after perl upgrade

Created on 17 Mar 2017  路  14Comments  路  Source: Homebrew/brew

  • [x] Ran brew update and retried your prior step?
  • [x] Ran brew doctor, fixed as many issues as possible and retried your prior step?
  • [x] Confirmed this is a problem with Homebrew/brew and not specific formulae? If it's a formulae-specific problem please file this issue at https://github.com/Homebrew/homebrew-core/issues/new

Bug reports:

I pinned vim in homebrew. And recently I ran brew upgrade to upgrade to latest packages. After that, when I try to run vim, I get the following error:

dyld: Library not loaded: /usr/local/opt/perl/lib/perl5/5.24.0/darwin-thread-multi-2level/CORE/libperl.dylib
  Referenced from: /usr/local/bin/vim
  Reason: image not found
[1]    44267 abort      vim

I have to unpin vim and reinstall vim to open vim without this error. Shouldn't there be some mechanism that prevents perl from being updated when vim is pinned?

brew config output:

HOMEBREW_VERSION: 1.1.11
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: 394f9fa0aaa5854aa52bc589708a079665dcf462
Last commit: 10 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 18dd3190df1943c1c133a9e8a47e3da1b4ed8e44
Core tap last commit: 37 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit haswell
Homebrew Ruby: 2.0.0-p648
Clang: 8.0 build 800
Git: 2.12.0 => /usr/local/bin/git
Perl: /usr/local/bin/perl => /usr/local/Cellar/perl/5.24.1/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /Users/koAllen/.rvm/rubies/ruby-2.3.0/bin/ruby
Java: 1.8.0_101
macOS: 10.12.2-x86_64
Xcode: N/A
CLT: 8.2.0.0.1.1480973914
X11: 2.7.9 => /opt/X11

brew doctor output:

Your system is ready to brew.

Most helpful comment

I met this issue too when I had ran brew upgrade锛宻o I tried:

  • brew uninstall --ignore-dependencies perl
  • brew uninstall vim
  • brew install vim

Event though I have to update my Vim version, but it works for me...

All 14 comments

Shouldn't there be some mechanism that prevents perl from being updated when vim is pinned?

No, sorry. This is a known issue with optional dependencies not being rebuilt.

So is there any plan to fix the issue? And how should I avoid these kind of issues?

So is there any plan to fix the issue?

No one is currently working on it but we'd accept PRs.

And how should I avoid these kind of issues?

Broadly: don't use options in formulae. That's not particularly helpful, I realise.

But I've only installed vim with --with-lua --with-luajit to support some vim plugins. I didn't use any options related to perl. Why would perl cause the problem in this case?

There is a mechanism:

iMac-TMP:homebrew-core joe$ brew upgrade godep
==> Upgrading 1 outdated package, with result:
godep 79_1
Error: You must `brew unpin go` as installing godep requires the latest version of pinned dependencies

The mechanism just doesn't work at all for requirements (it's depends_on :perl not depends_on "perl").

This is basically a variant of https://github.com/Homebrew/brew/pull/2348 where the usual mechanisms (in that case upgrade, in this case pin) fail to work as expected with requirements even when they're satisfied by the default formula.

Actually, I have that in reverse. The mechanism only works when it's the dependency that's pinned, not the dependent. Oh well.

If godep is pinned,

iMac-TMP:homebrew-core joe$ brew upgrade go
==> Upgrading 1 outdated package, with result:
go 1.8
==> Upgrading go 
==> Downloading https://homebrew.bintray.com/bottles/go-1.8.el_capitan.bottle.tar.gz
Already downloaded: /Users/joe/Library/Caches/Homebrew/go-1.8.el_capitan.bottle.tar.gz
==> Pouring go-1.8.el_capitan.bottle.tar.gz
==> Caveats
A valid GOPATH is required to use the `go get` command.
If $GOPATH is not specified, $HOME/go will be used by default:
  https://golang.org/doc/code.html#GOPATH

You may wish to add the GOROOT-based install location to your PATH:
  export PATH=$PATH:/usr/local/opt/go/libexec/bin
==> Summary
馃嵑  /usr/local/Cellar/go/1.8: 7,017 files, 281.6MB

No protection against breaking godep. You really shouldn't use pins.

But I've only installed vim with --with-lua --with-luajit to support some vim plugins.

Pretty sure this doesn't "work" FWIW; It links to either lua or luajit, not both.

Pretty sure this doesn't "work" FWIW; It links to either lua or luajit, not both.

Actually, what I did was brew reinstall vim --with-luajit. But what brew did was --with-lua --with-luajit. I don't think this is related to the issue I mentioned though.

Reinstall preserves your old options. So if you want the correct command in that case, brew uninstall vim; brew install --with-luajit vim rather than reinstall

I met this issue just now
Because i run brew upgrade perl

update

solution:

  • use system perl. namely if you install/upgrade perl by brew, the first thing that you should deal with is run brew uninstall perl

  • use system ruby for example rvm use system

  • brew uninstall vim

  • brew install --with-luajit vim

  • brew doctor

    • brew link vim
    • brew link luajit

Maybe you are likely to encounter error, for example fatal error: 'Python.h' file not found
You should use system python version, for example pyenv global system

Finally God bless you

I met this issue too when I had ran brew upgrade锛宻o I tried:

  • brew uninstall --ignore-dependencies perl
  • brew uninstall vim
  • brew install vim

Event though I have to update my Vim version, but it works for me...

Every time perl, python or ruby are upgraded or revision bumped, vim needs to be brew reinstall'd. It's a known issue. This would be a known issue even against the system Perl if Apple ever gets round to implementing another major Perl update.

I was getting this error during a build in VSCode:

dyld: Library not loaded: @@HOMEBREW_CELLAR@@/perl/5.26.1/lib/perl5/5.26.1/darwin-thread-multi-2level/CORE/libperl.dylib
Referenced from: /usr/local/bin/perl
Reason: image not found

Followed @remones guidance. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JustinTArthur picture JustinTArthur  路  3Comments

rtobrien picture rtobrien  路  3Comments

cfredhart picture cfredhart  路  4Comments

fooness picture fooness  路  4Comments

Rotonen picture Rotonen  路  4Comments