A structured lesson workspace with readable content, hands-on examples, and a clean path to completion.
macOS ships with a C compiler already installed, or rather, it ships with a shim that prompts you to install Xcode Command Line Tools the first time you type gcc or clang in a terminal. That shim is not a compiler. It is an installer trigger. A lot of beginners get confused when they type gcc and see a dialog box instead of a version string.
Open Terminal.app and run the following. A GUI dialog will appear asking you to confirm the install. Click Install and wait roughly five minutes depending on your connection.
Once the progress bar finishes, verify that clang (Apple's C/C++ compiler, a GCC-compatible frontend) is available.
On macOS, typing 'gcc' actually invokes clang under the hood. Apple aliases it. Both commands work identically for C code in this course. Use whichever feels natural.
Create a file called hello.c in your home directory. The content is the same test program from the Windows lesson.
#include <stdio.h>int main(void) {printf("macOS environment ready.\n");return 0;}
Notice there is no .exe extension on macOS. The binary is just called hello. Also notice we used ./hello rather than hello. macOS does not search the current directory by default when you type a bare command name, unlike Windows. That trips people up constantly.
VS Code with the C/C++ extension works identically on macOS. The tasks.json from the Windows lesson applies here too, just swap gcc for clang in the command field if you prefer explicitness. Alternatively, if you already use Xcode for other work, you can create a Command Line Tool project, but for this course a plain terminal plus editor keeps things simpler and more portable.
You are set. Every subsequent lesson compiles with clang or gcc interchangeably. The code is identical across platforms unless a lesson explicitly calls out a POSIX vs. Windows difference, which we will flag clearly when it happens.
Finish the lesson once you have worked through the material. This awards ★ 10 XP.