Git commands not working in Mac terminal: "dyld: Symbol not found: ___strlcpy_chk" error
Asked Answered
S

6

34

I am using the command git clone ssh://.... and getting the following error on the terminal:

dyld: lazy symbol binding failed: Symbol not found: ___strlcpy_chk
  Referenced from: /usr/local/git/bin/git
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: ___strlcpy_chk
  Referenced from: /usr/local/git/bin/git
  Expected in: /usr/lib/libSystem.B.dylib

Trace/BPT trap: 5
Sackville answered 5/1, 2014 at 3:27 Comment(3)
placed the following in my .bash_profile but same result: DYLD_LIBRARY_PATH=/usr/lib/libSystem.B.dylibSackville
State your MacOS version: 10.8? 10.6?Dumyat
Near-duplicate: git command-line on Mac OS error “dyld: Symbol not found: ___strlcpy_chk”. Should be merged into this question.Dumyat
S
36

I needed to install command line tools from Xcode. To do so-

  1. Open Xcode and hit Cmd+,
  2. Click Downloads
  3. Install command line tools.

http://www.hongkiat.com/blog/mountain-lion-git-fix/

Sackville answered 5/1, 2014 at 4:48 Comment(2)
This worked for me also, but I had to edit my .bash_profile to remove the /usr/git/bin from PATH, and only use the /usr/bin instead. Version 1.8.5.2 from Apple resides in /usr/bin and it does not have the dyld problem.Longshoreman
Hello people, 5 years later (2019) and working with Mojave, this solution still kind of worked for me. However, there seems not to be a "Download" panel in Xcode 10.2.1 anymore. After upgrading to the most recent Xcode (10.2.1), I had to 'manually' install the developer tools from developer.apple.com/download/more (I downloaded the file Command_Line_Tools_macOS_10.14_for_Xcode_10.2.1.dmg). Make sure you refresh your terminal before you try running git, though. Otherwise, you might still see the errors that made you read these posts....Sleepwalk
H
23

Had the same problem. I have OS X 10.8, so XCode was not a solution for me.

Turns out I had a Git version that's not compatible with my OS X version

This info might help(found it googling :) ):

If you are running:

  • 10.6 Snow Leopard: git-2.2.1-intel-universal-snow-leopard
  • 10.7 Lion: git-2.2.1-intel-universal-snow-leopard
  • 10.8 Mountain Lion: git-2.2.1-intel-universal-snow-leopard
  • 10.9 Mavericks: git-2.2.1-intel-universal-mavericks
  • 10.10 Yosemite: git-2.2.1-intel-universal-mavericks

You can download from here: http://sourceforge.net/projects/git-osx-installer/files/

Holeproof answered 3/2, 2015 at 5:34 Comment(2)
Will it be possible to run git-2.2.1-intel-universal-snow-leopard on 10.9+?Kennedy
Although @KateMak's accepted answer makes logical sense, it doesn't work properly for all machines. The older git builds as recommended by Dana were the way to go.Transeunt
H
5

I was also having troubles with the same error. I tried the PATH and .bash_profile tricks (didn't help). I wasn't really interested in installing Xcode and then the 'Command Line Tools' as others had suggested. But I did stumble upon half an answer.

First, I uninstalled my current version of Git (1.9.2). I then found that it is possible to install the Command Line Tools by themselves, without installing Xcode:

Xcode page:  https://developer.apple.com/xcode/
Downloads near the top
Scroll down to 'Additional Tools'->'View Downloads'
Command Line Tools (OS X Mountain Lion)

With those installed, doing 'git --version' returned this:

git version 1.8.5.2 (Apple Git-48)

The file "/usr/lib/libSystem.B.dylib" was untouched during this process. Or at least, the file size and date did not change. Since that library didn't change, I would surmise that it isn't Xcode that is fixing things, but the version of Git that is installed.

I thought about testing that theory and found the older source code for various versions of Git, but didn't have time to spend compiling/installing/testing each one to see if this theory is correct. And I didn't see a simple method of uninstalling the 'command line tools'. Maybe someone else is more intrepid. :)

-- J

Hollishollister answered 30/5, 2014 at 23:2 Comment(3)
With respect, that is not really a solution. This instals Apple's own version of git - now a bit old. It is not saying how to get the latest git binaries to work.Wellestablished
Correct, it does not install the latest version. But the original question, nor the described fixes (or half fix in my case), ever restricted it to, or described it as, installing the latest version, though.Hollishollister
This worked for me on OSX 10.8.5, which appears to be too old to work following the instructions in the accepted answer.Meaghanmeagher
K
2

One can also look at https://mcmap.net/q/451276/-git-error-dyld-lazy-symbol-binding-failed-symbol-not-found-_iconv_open and just make a .bash_profile, that worked for me.

Komatik answered 19/2, 2014 at 14:20 Comment(0)
W
2

The issue is that the git maintainers only support MaxOS10.9 (mavericks). If you have an earlier version, you can't use their distribution.

Recommended by somebody else at work - use (home)brew. Basically with brew installed you can merely use:

brew install git

and it will give you an up to date version. Subsequently to get a new version use:

brew upgrade git

Now brew itself uses git, so it might be that this install is recursive - I had to install it recently for another purpose and it took me several hours - but once you have it there, things should be OK. All I can say is that when I installed brew originally, "git" still referred to the 1.8.x Apple version, and with this change I'm now getting git v2.1.0.

Wellestablished answered 15/9, 2014 at 17:6 Comment(0)
N
2

I was also plagued with git causing the dreaded:

dyld: lazy symbol binding failed: Symbol not found: ___strlcpy_chk
Referenced from: /usr/local/bin/git
Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: ___strlcpy_chk
Referenced from: /usr/local/bin/git
Expected in: /usr/lib/libSystem.B.dylib

After reading many successfully executed suggestions revolving around updating xCode (>2G) or just the Command Line Tools part of xCode (~200M) I installed the Command Line Tools and this fixed my problem when using git from the command line.

Interestingly, I was having trouble with PyCharm getting the same error, even after I did the update. I was able to fix this by changing the path where git was found (In PyCharm->Preferences...->Version Control->Git, I changed /usr/local/bin/git to /usr/bin/git near the top):

Image of PyCharm->Preferences...->Version Control->Git

I finally figured out exactly what’s going on -- and to pay homage to all the help I received from the web, want to share the specifics:

I discovered there were two versions of git installed on my machine:

/usr/bin/git 
/usr/local/git/bin/git 
(also interestingly: /usr/local/bin/git -> ../git/bin/git)

Some suggestions for putting /usr/bin in the path are somewhat helpful, but might not solve the niggling problem that there’s a version of git installed that doesn’t work.

So note this:

$ pwd 
/usr/local/git/bin 
$./git --version 
git version 2.8.1

And:

$ pwd 
/usr/bin 
$ ./git --version 
git version 1.8.5.2 (Apple Git-48)

The Apple git version is the one that works -- this is the one likely installed by installing the Command Line Tools from xCode. Note the paths in each. Also note that you don't necessarily have to install the whole Command Line Tools, just a proper version of git.

Further, in the /usr/local/git/bin/ directory, there’s an uninstall.sh script. In that script, it uses pkgutil to uninstall the version of git. (You should use this script to do the uninstall.) You can run this line to verify that this utility has record of installing git:

pkgutil --packages | grep com.git.pkg

This is not the version you want. You want the Apple version. Use the script in the /usr/local/git/bin to uninstall the broken version of git.

Uninstalling it assures you will never get this error, and that you will be using the proper version of git.

Hope that helps some others. The info was good but incomplete. And there was almost nothing for PyCharm.

November answered 18/5, 2016 at 7:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.