xqcu8a
Last Updated: February 25, 2016
·
813
· mxcl
Img 0719

Compile from CLI with only Xcode installed

NOTE that OS X 10.9 does the below for you transparently, so you don't need the following anymore.

By this I mean, you install Xcode, but don’t install the Command Line Tools package. This means you don’t have to upgrade the Command Line Tools package, etc. So it’s for convenience.

Make this accessible to your shell:

ccenv() {
  SDK="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"
  export CC='xcrun cc'
  export CPPFLAGS="-isystem$SDK/usr/include -iframework$SDK/System/Library/Frameworks"
  export LDFLAGS="-L$SDK/usr/lib"
}

Then you type ccenv in your shell to enable this. If that does’t work, try a brew sh.

Say Thanks
Respond

1 Response
Add your response

9338
2e93f6a5438c2187cabafde2dd91f07f

I'd rather use this as SDK: xcodebuild -version -sdk macosx Path

over 1 year ago ·