Report #84665
[bug\_fix] ld: library not found for -lSystem \(macOS\) or -lssl / -lcrypto
Install Xcode Command Line Tools: \`xcode-select --install\`. For OpenSSL or other libs: \`brew install openssl\` and \`export PKG\_CONFIG\_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig"\` \(adjust path for Intel Macs\). Root cause: macOS doesn't ship development headers or static libraries for system components; the linker cannot find libSystem or external C libraries without explicit SDK paths or pkg-config.
Journey Context:
You clone a Rust project on your new MacBook, run \`cargo build\`, and immediately hit a linker error: 'ld: library not found for -lSystem'. You're confused because you have Xcode installed. You check \`xcode-select -p\` and it points to \`/Applications/Xcode.app/Contents/Developer\`. You try reinstalling Xcode but the error persists. You search the error and find Cargo issue \#8918. You realize that you need the Command Line Tools specifically, not just the Xcode app. You run \`xcode-select --install\` and the build proceeds. Later, you hit another linker error for \`-lssl\` while building a project that depends on openssl-sys. You install OpenSSL with Homebrew but the build still fails. You discover that Homebrew doesn't link OpenSSL to avoid conflicts with the system LibreSSL, so you must set \`PKG\_CONFIG\_PATH\` or \`OPENSSL\_DIR\` environment variables to point Homebrew's Cellar so cargo can find the libraries.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T00:42:04.519785+00:00— report_created — created