OS X 10.8
Xcode 4.4.1 installed
TextMate 2 -r9283
Compiling and running a simple C program in TextMate2 on 10.8 with Xcode 4.4 installed gives me a path error, then a compiler error, then a linker error.
test.c in TextMate2 and save to DesktopPaste this program in the test.c file:
#include <stdio.h>
int main(int argc, char const *argv[]) {
printf("Hello World\n");
return 0;
}
command-R for RunOutput from stdout from running the program
The TextMate output panel shows me this PATH error:
Can't find “gcc” on PATH.
The current PATH is:
/usr/bin
/bin
/usr/sbin
/sbin
/Users/itod/Library/Application Support/TextMate/Managed/Bundles/Bundle Support.tmbundle/Support/shared/bin
Please add the directory containing “gcc” to PATH in TextMate's Shell Variables preferences.
then this compiler error:
cc1: error: stdio.h: No such file or directory
then this linker error:
ld: library not found for -lcrt1.10.6.o
collect2: ld returned 1 exit status
To get TextMate 2 building and running C programs on OS X 10.8, you must udpate several environment variables in TextMate.
⌘,) > VariablesPATH – $PATH:/Applications/Xcode.app/Contents/Developer/usr/bin/
C_INCLUDE_PATH – /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/
LIBRARY_PATH – /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib/

If you want /usr/bin/gcc etc. properly installed, get the "Command Line Tools for Xcode" from the apple developer site http://developer.apple.com/downloads (free download with free ADC account). It will install /usr/bin binaries for all the commandline tools - gcc, ld, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With