Step-by-step instructions to get C running on Windows, Mac, and Linux.
Download the installer from the MSYS2 official site and run it.
You can keep the default install location (C:\msys64).
Open the MSYS2 terminal and run:
Open "Edit the system environment variables" and add the following to Path:
Open a new Command Prompt or PowerShell and run:
If you see version info, you are good to go.
Open PowerShell as Administrator and run the following. A reboot is required.
In the WSL terminal (Ubuntu), run:
Open Terminal and run:
Click "Install" in the dialog that appears. It takes a few minutes.
If version info prints, you are done. The gcc on Mac is Apple Clang (a C-compatible compiler).
Ubuntu / Debian family:
Fedora / RHEL family:
Arch Linux:
Download the installer for your OS from the Visual Studio Code official site and run it.
Open VSCode, click the Extensions icon (four squares) on the left, search for the following, and install:
Open the VSCode terminal (Ctrl+`) and follow the next section to compile and run.
Create a file named hello.c with the following content.
#include <stdio.h> int main(void) { printf("Hello, World!\n"); return 0; }
In the terminal, go to the folder that contains hello.c and run:
If there are no errors, hello (or hello.exe on Windows) is produced.
On Windows, enter .\hello.exe or just hello.
PATH is not set correctly. Add C:\msys64\ucrt64\bin to the Path environment variable, then open a new Command Prompt.
Command Line Tools are not installed. Run xcode-select --install again.
The file has no execute permission. Run chmod +x hello and try ./hello again.
Save your source file as UTF-8. Alternatively, compile with gcc -fexec-charset=CP932.