Skip to content

Instantly share code, notes, and snippets.

@keikoro
Last active December 24, 2015 23:49
Show Gist options
  • Save keikoro/6883661 to your computer and use it in GitHub Desktop.
Save keikoro/6883661 to your computer and use it in GitHub Desktop.
Compile C on Mac OS X using the command line instead of e.g. Xcode. Requires GCC (GNU Compiler Collection) to be installed, which is part of Command Line Tools (which can be installed through Xcode or as separate developer package).
# gcc start GNU compiler
# -Wall [optional] flag to show warnings (all possible warnings)
# $DESIREDEXECUTABLENAME [optional] name of resulting executable file; otherwise gcc auto-outputs to a.out
# $MYFILE.c C file that should get compiled
gcc -Wall $DESIREDEXECUTABLENAME $MYFILE.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment