When I try to use MacVim from the command line, I get

dyld: Library not loaded: /System/Library/Perl/5.12/darwin-thread-multi-2level/CORE/libperl.dylib
Referenced from: /Applications/MacVim.app/Contents/MacOS/Vim
Reason: image not found
Trace/BPT trap: 5

I tried brew install -update perl, but then I found that the issue is not Perl. It is where Vim is looking.

$ ls /usr/local/opt/perl/lib/

I tried brew install -update macvim, but the perl version from the command line doesn't work right either.

MBP:mysite $ perl -v

This is perl 5, version 18, subversion 2 (v5.18.2) built for darwin-thread-multi-2level

Summary, I have MacVim looking for Perl version 5.12; I have the terminal using Perl 5.18.2; I have version 5.20.1 installed. How do I repoint everything?

 $ ls -l /usr/bin/perl*
-rwxr-xr-x   1 root  wheel  58416 Sep  9  2014 /usr/bin/perl
-rwxr-xr-x   1 root  wheel  35600 Sep  9  2014 /usr/bin/perl5.16
-rwxr-xr-x   1 root  wheel  35600 Sep  9  2014 /usr/bin/perl5.18
-rwxr-xr-x  38 root  wheel    811 Sep  9  2014 /usr/bin/perlbug

I did find this related question, which is not answered.


I have solution, not a great one, but it works for fixing MacVim.

brew uninstall macvim
brew install macvim
brew linkapps macvim

Worked for me. Hopefully, the related question above will be the answer to my Perl version problem.


I was hitting this problem after upgrading to 10.11, and the accepted solution didn't work for me. I found that the problem was not with the updated MacVim install, but rather that the mvim script was finding an old MacVim binary I didn't even know I had rather than the freshly-updated one.

So, if anyone hits this problem and the above fix doesn't work, look closely at this line in your error output:

  Referenced from: /Applications/MacVim.app/Contents/MacOS/Vim

and make sure it's referencing the location of MacVim you expect it to be using!

(Mine was finding one in ~/bin/)


You can try to symlink the Perl 5.18 as 5.12:

sudo ln -s /System/Library/Perl/5.18 /System/Library/Perl/5.12

This will take care of the Perl problem, but it did just lead to next error:

dyld: Library not loaded: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/libruby.1.dylib
  Referenced from: /Applications/MacVim.app/Contents/MacOS/Vim
  Reason: image not found

This is potentially bigger problem because there is greater chance of incompatibilities between Ruby 1.8 and Ruby 2.0 libraries.

ll /System/Library/Frameworks/Ruby.framework/Versions/
total 4.0K
drwxr-xr-x 7 root 238 Jul  3 16:39 2.0
lrwxr-xr-x 1 root   3 Jul  3 14:18 Current -> 2.0

At this point I have given up and used the above method, which worked fine.

  • 1
    This is a terrible idea; don't do it. The Perl 5.12 and 5.18 libraries are not compatible; linking them together will result in bizarre errors later on. – duskwuff Jun 21 '16 at 2:32

brew link perl or brew link --overwrite perl

before installing or linking the app should also work and it's probably the root cause of the issue.

Also it's way more clean and less risky that playing with symlinks over different versions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.