git command-line on Mac OS error “dyld: Symbol not

2020-08-24 01:40发布

问题:

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.

回答1:

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.



回答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


回答3:

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