Installing GCC Compiler on Mac OS X

This post will guide you how to install GNU GCC compiler on Mac OS X system. How do I install command line tool for xcode package to install Gcc compiler on Mac OS system. How to install gcc command line tool in Mac OS Sierra.

Installing GCC Compiler on Mac OS X


You need a free developer login to Apple Developers to download one package named “Command Line Tools for Xcode“. or you can install Xcode via App store directly,  then open Xcode to install command line tools.

What is Xcode?

Xcode is a large suite of software development tools and libraries from Apple. The Xcode Command Line Tools are part of XCode. Installation of many common Unix-based tools requires the GCC compiler. The Xcode Command Line Tools include a GCC compiler.

Gcc Compiler Verifiecation


After the Command Line Tools for Xcode package is installed, you can try to check the GCC compiler if it is installed properly. Type:

#gcc --version

Or you can create a C program named fio.c via vim text editor and append the following code:

#include<stdio.h>
int main() {
    printf("Hello world");
    return 0;
}

Save and close the file and then compile and execute it, type:

$ make fio.c
$ ./fio

 

You might also like:

Sidebar



back to top