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
.
Written by Max Howell
Related protips
1 Response
I'd rather use this as SDK: xcodebuild -version -sdk macosx Path
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Cli
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#