9

I installed git on Mac os, when i try to create a new repository with git init, i get this error :

 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

NB: I don't have Xcode installed.

smci
  • 32,567
  • 20
  • 113
  • 146
Nabil Lemsieh
  • 716
  • 4
  • 11
  • 27
  • 2
    For anyone on Mountain Lion, your problem might be that you've installed Git 2.2.1 for Mavericks. Visit the downloads page and select the Snow Leopard installation instead. This addressed the issue for me, while reinstalling Command Line Tools and fudging with other nonsense didn't. If you do install Command Line Tools, it will include an old version of Git, so to ensure you're using 2.2.1 (or whatever the version is when you read this), just add `/usr/local/git/bin` to your `PATH`. – orokusaki Apr 02 '15 at 03:48
  • Possible duplicate of [Git commands not working in Mac terminal: "dyld: Symbol not found: \_\_\_strlcpy\_chk" error](http://stackoverflow.com/questions/20929689/git-commands-not-working-in-mac-terminal-dyld-symbol-not-found-strlcpy-ch) – smci Feb 24 '17 at 02:34

3 Answers3

6

you can consider my solution: Open XCode(Install one if you didn't install it.), and press "COMMAND + ,". Click "Download". Find "command line tool", download and install it.Then restart your mac,done!

Hope you can solve it with the same way.

Jason Lee
  • 71
  • 5
2

Looks like /usr/local/git/bin/git has been compiled with the wrong -mmacosx-version-min value. You don't mention how it got there, so I cannot help further along that path.

I would recommend installing macports and simply doing:

$ sudo port install git-core git-extras
trojanfoe
  • 120,358
  • 21
  • 212
  • 242
-1

I was also having troubles with the same error after running this command:

$ git clone https://bitbucket.org/name/testproject.git

I tried the PATH trick (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

Cronk
  • 453
  • 1
  • 6
  • 16