C Environment Setup in Linux, Mac OS, and Windows

For today’s tutorial, we will discuss on how to setup the environment in LINUX, MAC OS and WINDOWS. To setup the environment in C language we will need the two software application tools in a computer or laptop. The following two software tools are “Text Editor” and “C compiler“.

Text Editor in C Language

The use of this editor is for creating a C program. Here are the few examples of editors Windows Notepad, OS Edit command, Epsilon, EMACS, and VIM or VI.

However, text editors have many several names and versions and depend on various operating systems. For example in the case of notepad, it will use on windows computer and vi or vim it will also use in windows along with the LINUX or UNIX.

In addition, the files that you will build with your editor it is called source files and consist of code program. A source files for a C programs are normally named with an extension “.c”.

Finally, before you begin to program you must have at least one text editor and a little understanding of writing computer programming. Just save it in a file, compile and lastly execute it.

You may also read: Learn C Tutorial for Beginners

Compiler in C Programming Language

The program code written in a source file it will be readable to humans for a source code of the program. It will need to meet the requirements given to complete the compilation into the machine language. So that the CPU(Central Processing Unit) can literally execute the code program.

In addition, the compiler will actually compile the source code for the final execution of the program. Usually, in C language the commonly used compiler available is GNU C/C++ compiler. However, you can use other compilers like hp if it is compatible with your operating system.

How to install in Linux/Unix?

  • First, If you’re using a Linux/Unix
  • Second, check if the GCC compiler is installed in your operating system(OS).
  • Third, Open your Command Prompt(CMD) and copy this command line “$ gcc -v“. To know if you have a GCC in your system.
  • Finally, If the GNU compiler is already installed in your operating system. It will show you a message like this below.

Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure –prefix=/usr …….
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)

Note: If in case GCC is not installed on your operating system, you can download it and install it on your system by following the exact available instructions at https://gcc.gnu.org/install/.

Reminder: All of the examples provided in this tutorial have been built using the Cent OS version of the Linux operating system, which is the foundation on which it was designed.

How to install in Mac OS?

To install in MAC OS, the simple way to access GCC is to download from the apple website the XCode development environment. Then follow the simple instructions or guide for the installation. Finally, If you installed the XCode setup, you can already use the GNU compiler for C language in your system.

Note: Right now the XCode is available to download at developer.apple.com/technologies/tools/

How to install in windows?

Time needed: 3 minutes

Here are the steps on how to install the GCC on windows.

  • Step 1: Install MinGW

    Firstly, for installing the GCC on your windows you will need to install MinGW on your computer.

  • Step 2: Download MinGW

    Secondly, to download the MinGW you need to visit this link  www.mingw.org

  • Step 3: Download the Latest Version of MinGW

    Thirdly, Download the latest version of MinGW by choosing windows version 1.17.0

  • Step 4: Install gcc-core, gcc-g++

    Finally, at the same time while installing MinGW. You need to install these important libraries which are gcc-core, gcc-g++, binutils, and the MinGW runtime.

  • Step 5: Go to PATH environment variable

    At this time, you will go to the PATH environment variable by adding the bin subdirectory of the installation of MinGW. The reason to add the bin subdirectory of MinGW is to define these applications in the command prompt to know their versions and names.

Note: If the installation of MinGW is complete or finished, you may use the Windows command prompt(CMD) to run the GNU programs like gcc, g++, ar, ranlib, dlltool, and many more.


In conclusion, we already give you an idea on how to set up and install the MinGW environment on a LINUX, MAC OS and WINDOWS.

In addition, we also discuss the two important software tools that you need in your computer which are text editor and C compiler to run your source code.

In the previous tutorial, we discuss the Overview of C Programming Language and for the next tutorial, we will discuss theStructure of C Program.

Leave a Comment