0% found this document useful (0 votes)
34 views2 pages

C Programming Mac Guide

This document provides a step-by-step guide for setting up and compiling C language programs on a Mac without using VS Code. It includes instructions for installing Xcode Command Line Tools, writing a simple C program, and compiling and running it using Terminal. Additionally, it lists optional text editors for writing C code.

Uploaded by

prasadganta240
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views2 pages

C Programming Mac Guide

This document provides a step-by-step guide for setting up and compiling C language programs on a Mac without using VS Code. It includes instructions for installing Xcode Command Line Tools, writing a simple C program, and compiling and running it using Terminal. Additionally, it lists optional text editors for writing C code.

Uploaded by

prasadganta240
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

C Language Setup & Compilation on Mac (Without VS Code)

Step 1: Install Xcode Command Line Tools

Open Terminal and run:

xcode-select --install

Click 'Install' when prompted. After installation, verify with:

gcc --version

You should see the GCC version.

Step 2: Write Your First C Program

Open any text editor (TextEdit, Sublime Text, or nano).

Example code:

#include <stdio.h>

int main() {

printf("Hello, World!\n");

return 0;

Save the file as hello.c (e.g., on your Desktop).

Step 3: Compile and Run

In Terminal, navigate to the directory where hello.c is saved:

cd ~/Desktop
C Language Setup & Compilation on Mac (Without VS Code)

Compile the program:

gcc hello.c -o hello

Run the executable:

./hello

Expected Output:

Hello, World!

Optional Editors

You can also use these editors:

- Sublime Text

- Atom

- BBEdit

- Nano (in Terminal):

nano hello.c

You might also like