dyld: Library not loaded: libperl.dylib Referenced from: perl5.18
Asked Answered
C

4

13

Im getting dyld library not found error in my xcode.

dyld: Library not loaded: /System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/libperl.dylib Referenced from: /usr/bin/perl5.18

So I tried to reinstall perl as following.But i got the following error message in my terminal when it is getting downloaded

Setting Perl 5.16.0 to default bash: line 94: perlbrew: command not found

So i tried to install perlbrew as follows,

\curl -L https://install.perlbrew.pl | bash

But it is providing the same dyld error message as follows,

dyld: Library not loaded: /System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/libperl.dylib Referenced from: /usr/bin/perl5.18

How can i be able to sort this out?

Coleorhiza answered 24/9, 2016 at 11:41 Comment(0)
R
0

Looking at the the error message

Setting Perl 5.16.0 to default bash: line 94: perlbrew: command not found

I can see that you used below to install Perl

curl -L https://raw.githubusercontent.com/ranguard/installing-perl/master/scripts/install_perl_on_osx.sh | bash

The above script uses perlbrew therefore you are seeing the same error while installing perlbrew using \curl -L https://install.perlbrew.pl | bash.

I think you have corrupted your system Perl. You should take backup of your system and reinstall OSX. After that install perlbrew and never touch your system perl again.

Reference answered 26/9, 2016 at 4:50 Comment(0)
W
35

I had this exact same error myself just now, here's how I solved it.

TLDR:

  • update homebrew by running git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow and then brew update
  • then search for any out-of-date packages using brew outdated
  • then reinstall any/all outdated packages if they are causing you any issues
  • 2023 UPDATE: Homebrew appears now to perform all of these steps automatically by default, so if you simply run brew upgrade <package> brew will update itself, and update the requested package, and then any other outdated packages it finds

Background: So, I updated my Mac OS (Big Sur) last night. I flipped it open this morning, very unassuming, and tried to open a text file in vim (Macvim). I received an error message identical to the one above. Here is my error message in full.

dyld: Library not loaded: /System/Library/Perl/5.28/darwin-thread-multi-2level/CORE/libperl.dylib
  Referenced from: /usr/local/Cellar/macvim/8.2-171/MacVim.app/Contents/MacOS/Vim
  Reason: image not found
Abort trap: 6

This stack post (the one you're reading) was the first result when I searched for the error. I noted the OP found the problem in Xcode, so I knew this problem was more general than my specific case, and (obviously) had something to do with the macOS update.

The first thing I did was update my Homebrew, as per the recommendation from this webpage.

NOTE: When updating Homebrew, brew first warned me that from now on I needed to first run this command:

git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow

Then you simply run:

brew update

If you don't have Homebrew installed then definitely do that here

Brew (in its usual style), after the update, helpfully informed me that several of my 'formulae' were out of date. So I ran:

brew outdated

And it returned a list of outdated packages, one of which was macvim.

So, after updating brew, I ran

brew upgrade macvim

And this solved the problem for me.

I'm posting this answer to help anyone with the same problem, since you might get the error somewhere besides Xcode, and it's clear the problem is most likely after an update of the OS, and apple decides to mess around with lib locations.

After an update, before you go chasing your tail, check that all your software is up to date.

Thanks to appuals for providing the most sensible solutions to this problem. I take no credit.

NOTE: If your problem is coming from Xcode, then you may need to update Xcode, which you would be better off doing via the App Store.

Woolf answered 26/5, 2021 at 20:14 Comment(4)
I guess the crucial part is upgrading MacVim. What still confuses me is that I got this error even when trying to load the "normal" vim in a terminal. Why does MacVim interfere with that?Wattmeter
@Wattmeter The crucial part is upgrading whatever packages may be out of date, especially after an OS update. If you have MacVim installed, then you're still running MacVim in the terminal. Vim will be symlinked to MacVim (mvim -v).Woolf
Right, that explains it. Thanks!Wattmeter
this guy right here, he helped fix my vim troublesLentiginous
R
1

I get the same error after I upgrade my OSX to 11.6. And only brew upgrade worked for me.

Reflect answered 14/10, 2021 at 10:43 Comment(0)
R
0

Looking at the the error message

Setting Perl 5.16.0 to default bash: line 94: perlbrew: command not found

I can see that you used below to install Perl

curl -L https://raw.githubusercontent.com/ranguard/installing-perl/master/scripts/install_perl_on_osx.sh | bash

The above script uses perlbrew therefore you are seeing the same error while installing perlbrew using \curl -L https://install.perlbrew.pl | bash.

I think you have corrupted your system Perl. You should take backup of your system and reinstall OSX. After that install perlbrew and never touch your system perl again.

Reference answered 26/9, 2016 at 4:50 Comment(0)
G
0

In my case, had to do a fresh install of Homebrew. Downloaded the script and ran it locally, but one could also run the command using

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

that fixed some of the errors I was facing.

Goingson answered 21/7, 2023 at 16:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.