Installing XCode command line tools fails - xcode

I'm trying to install the command line tools on Yosemite but I'm getting the following error:
$ xcode-select --install
dyld: Symbol not found: __cg_png_create_info_struct
Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /usr/local/lib/libPng.dylib
in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Trace/BPT trap: 5
What is causing this error and how do I fix it?

Related

xcode-select cannot locate clang, even after installing command line tools

When I try to run the clang command, I get the following error:
xcode-select: Failed to locate 'clang', requesting installation of command line developer tools.
And then I receive this pop-up:
However, no matter how many times I click "Install" - going through a 15-minute install process - I continue to get the same error.
I have also tried running xcode-select --install however that gives the following error:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
I have also tried manually installing from here.
I'm on an M1 mac running macOS Monterey Version 12.5.
It also yields a core dump:
2022-09-19 10:51:04.669 xcodebuild[1541:17443] [MT] DVTPlugInLoading: Failed to load code for plug-in com.apple.dt.IDESimulatorAvailability (/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin), error = Error Domain=NSCocoaErrorDomain Code=3588 "dlopen(/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability, 0x0109): Symbol not found: (_OBJC_CLASS_$_SimDiskImage)
Referenced from: '/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability'
Expected in: '/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator'" UserInfo={NSLocalizedFailureReason=The bundle couldn’t be loaded., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability, NSDebugDescription=dlopen(/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability, 0x0109): Symbol not found: (_OBJC_CLASS_$_SimDiskImage)
Referenced from: '/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability'
Expected in: '/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator', NSBundlePath=/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin, NSLocalizedDescription=The bundle “IDESimulatorAvailability” couldn’t be loaded.}, dyldError = dlopen(/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability, 0x0000): Symbol not found: (_OBJC_CLASS_$_SimDiskImage)
Referenced from: '/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability'
Expected in: '/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator'
2022-09-19 10:51:04.688 xcodebuild[1541:17443] [MT] DVTAssertions: ASSERTION FAILURE in /System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot2/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-21303/DVTFoundation/PlugInArchitecture/DataModel/DVTPlugIn.m:374
Details: Failed to load code for plug-in com.apple.dt.IDESimulatorAvailability (/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin)
Please ensure Xcode packages are up-to-date — try running 'xcodebuild -runFirstLaunch'.
NSBundle error: Error Domain=NSCocoaErrorDomain Code=3588 "dlopen(/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability, 0x0109): Symbol not found: (_OBJC_CLASS_$_SimDiskImage)
Referenced from: '/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability'
Expected in: '/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator'" UserInfo={NSLocalizedFailureReason=The bundle couldn’t be loaded., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability, NSDebugDescription=dlopen(/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability, 0x0109): Symbol not found: (_OBJC_CLASS_$_SimDiskImage)
Referenced from: '/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability'
Expected in: '/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator', NSBundlePath=/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin, NSLocalizedDescription=The bundle “IDESimulatorAvailability” couldn’t be loaded.}
Object: <DVTPlugIn: 0x60000080b7a0>
Method: -loadAssertingOnError:error:
Thread: <_NSMainThread: 0x600002c402c0>{number = 1, name = main}
Hints:
Backtrace:
0 0x000000010653d410
1 0x000000010653caec
2 0x000000010653cc6c
3 0x00000001063eb2ac
4 0x00000001063b1118
5 0x00000001063af528
6 0x0000000181aa01b4
7 0x0000000181aaf414
8 0x000000010658158c
9 0x000000010655d4b0
10 0x00000001063af3c0
11 0x00000001063af5e0
12 0x00000001074372ec
13 0x0000000107436ae0
14 0x00000001074361e8
15 0x0000000104c70324
16 0x0000000104c21e0c
sh: line 1: 1543 Abort trap: 6 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find clang 2> /dev/null
clang: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find clang 2> /dev/null' failed with exit code 34304: (null) (errno=Invalid argument)
How can I install clang?
Please ensure Xcode packages are up-to-date — try running xcodebuild -runFirstLaunch.
This worked for me.
I had the same problem and updated Xcode, relinked paths etc, which didn't help.
What worked was opening Xcode after the update and accepting the prompt to load essential development tools (for macOS and iOS).
A bit hidden in the error message is also the CLI solution: "Please ensure Xcode packages are up-to-date — try running 'xcodebuild -runFirstLaunch'."
You can also open Xcode, select the default runtime tools (MacOS and iOS in my case), then clang should run as normal.
I believe this is the same as doing #LanderTome's answer, but not able to verify.
After installing XCode 14.1 on MacOS Ventura 13.0.1, my clang didn't work with an error very similar to this, and repeatedly tried to install the XCode command line tools. It turns out that xcode-select was pointing to the command line tools that are part of the full XCode package, and failing to find clang in there. clang is included in the command line tools package, but not in some versions of the full XCode package.
What I did to fix it was:
sudo xcode-select -switch /Library/Developer/CommandLineTools
This switches the location that clang and other tools are run from. If you want to switch back to running them from the XCode package, you can use:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

Can't read even though there is dylib symbol

I get this error when running my java program.
(on intellij ide.)
dyld: lazy symbol binding failed: Symbol not found:
___emutls_get_address Referenced from: /Users/xxx/.javacpp/cache/nd4j-native-1.0.0-beta5-macosx-x86_64.jar/org/nd4j/nativeblas/macosx-x86_64/libnd4jcpu.dylib
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: ___emutls_get_address Referenced from:
/Users/xxx/.javacpp/cache/nd4j-native-1.0.0-beta5-macosx-x86_64.jar/org/nd4j/nativeblas/macosx-x86_64/libnd4jcpu.dylib
Expected in: /usr/lib/libSystem.B.dylib
I checked the /usr/lib/ path but libSystem.B.dylib exists.
Do you have a solution?
Postscript
I was able to run the same version of DL4J (ND4J) on the same mac.
However, after updating mac and xcode, this error came out soon.
xcode-select --install has been executed.
Please try latest DL4J snapshots, this problem should be resolved there.
Instructions: https://deeplearning4j.org/docs/latest/deeplearning4j-config-snapshots

dyld: lazy symbol binding failed: Symbol not found: _pcap_lookupdev

I have installed bettercap on Macbook Pro OSX EL Capitan 10.11.3, after installing while I start bettercap it shows below error.
dyld: lazy symbol binding failed: Symbol not found: _pcap_lookupdev
Referenced from: /Library/Ruby/Gems/2.0.0/gems/pcaprub-0.12.1/lib/pcaprub_c.bundle
Expected in: flat namespace
dyld: Symbol not found: _pcap_lookupdev
Referenced from: /Library/Ruby/Gems/2.0.0/gems/pcaprub-0.12.1/lib/pcaprub_c.bundle
Expected in: flat namespace
Here is a screenshot:
me too, but libpcap is installed on the system.
/usr/lib/libpcap.A.dylib
/usr/lib/libpcap.dylib
also pcaprub with gem is installed and is who that give us this error.

Link issue of ImageMagick on Mac 10.11.1

I have just installed ImageMagick on Mac 10.11.1, but can't run the command, "convert". I received the following error message. Any help would be greatly appreciated.
The DYLD_LIBRARY_PATH is not set in the .bash_profile.
dyld: Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /usr/local/ImageMagick-6.9.2/lib//libjpeg.9.dylib
in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Trace/BPT trap: 5
For me at least, the answer is to simply remove the offending library (libraries in my case) from /usr/local/ImageMagick-6.9.2/lib/ as then the default ones are picked up -- no need for symlink(s).

Cannot run git clone command on Mac OS X

I'm trying to make git clone work with Mac OS X Mountain Lion, the git installed fine but doing git clone does not and just throws:
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
I've tried the SO answers with having a .bash_profile and restarting the machine, but none worked.
(Re)install XCode and the Command Line Tools: http://www.hongkiat.com/blog/mountain-lion-git-fix/

Resources