OSX 10.8 xcrun (No such file or directory)

Lukas Grebe picture Lukas Grebe · Oct 24, 2012 · Viewed 15.7k times · Source

When executing gem install jekyll on OSX 10.8 with the standalone Command Line Tools package from Apple's Developer site installed (no Xcode), i run into the following error:

Building native extensions. This could take a while...

ERROR: Error installing jekyll:

ERROR: Failed to build gem native extension.

xcrun cc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common   -c porter.c
xcrun: Error: failed to exec real xcrun. (No such file or directory)

gcc is installed:

$ which cc
/usr/bin/cc

the look-up path for xcrun is set:

xcode-select -print-path
/usr/bin

yet no matter which arguments i try, xcrun will always return

xcrun: Error: failed to exec real xcrun. (No such file or directory)

man xcrun reads "When xcrun is invoked with the name xcrun , the flags -log and -verbose are useful debugging aids. The flag -no-cache can be used to bypass cache lookup." but none of this seems to have any effect: the only output remains the above…

Solution: following Ned Deily's advice below, i've replaced xcrun with a shell script to simply call the given arguments:

#!/bin/bash
$@

Answer

Ned Deily picture Ned Deily · Oct 24, 2012

Unfortunately, at least the last time I played with it, I found you really can't use xcrun with just the standalone Command Line Tools package. It apparently wasn't designed for that use case; the standalone package is a fairly recent innovation with Xcode 4. If the product you are trying to install really depends on xcrun, you may need to install the full Xcode.app distribution to get around it. That, or modify the distribution's Makefile et al to not use xcrun. Or, possibly (untested), create some directories and/or symlinks to fake xcrun into thinking you have Xcode.app installed - a messy hack.