Step 1, download and install Xcode that is latest for your OS version. I usually use https://xcodereleases.com/ It might require an Apple ID. Note that Xcode 4 for 10.6 requires Apple developer program (so skip that and use latest Xcode 3). Making sure command-line tools are installed.
Step 2, open Terminal (iTerm would be even better) and navigate to a working directory (folder) of your choice.
Step 3, In the terminal,
Step 4, Type/paste the following code and save the file.
Step 5, Back to the terminal,
Did you see "hello, world" printed out on your terminal? If so, congratulations, you managed to write a C program in the traditional Unix way (apart from the text editor used maybe).
Now, where to go from here? A few ideas:
Step 2, open Terminal (iTerm would be even better) and navigate to a working directory (folder) of your choice.
Step 3, In the terminal,
Code:
$ touch hello.c
$ open -a TextEdit.app hello.c
Step 4, Type/paste the following code and save the file.
Code:
#include <stdio.h>
main()
{
printf("hello, world\n");
}
Step 5, Back to the terminal,
Code:
$ cc hello.c
$ ./a.out
Did you see "hello, world" printed out on your terminal? If so, congratulations, you managed to write a C program in the traditional Unix way (apart from the text editor used maybe).
Now, where to go from here? A few ideas:
- Finish the rest of https://s3-us-west-2.amazonaws.com/belllabs-microsite-dritchie/cbook/index.html
- Check out http://cocoadevcentral.com or https://m.youtube.com/user/AppleProgramming the Cocoa series started using 10.6 IIRC
- https://www.stroustrup.com/programming.html and then https://m.youtube.com/user/CppCon for C++
- https://train.usaco.org/ for algorithmic/competitive programming
Last edited: