Last Updated: February 25, 2016
· 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() {
  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

1 Response
Add your response


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

over 1 year ago ·