Install CodeBlocks on Windows, Mac and on Linux

This tutorial is about how to install Codeblocks on your local Environment or PC with Windows, Mac or on Linux.

CodeBlocks is a cross-platform, open-source, free IDE that supports GCC, Visual C++, and Clang compilers. Codeblocks developed in C++ using wxWidgets for Windows and Linux as the GUI toolkit. It is oriented towards C, C++, and Fortran with custom build system support.

Latest Codeblocks for MAC version is 13.12 released in 2013 and has been ported to FreeBSD, OpenBSD and Solaris.

Features of CodeBlocks

  • It supports multiple compilers including GCC, MinGW, Microsoft Visual C++, LLVM Clang, Intel C++ compiler, Borland C++, LCC and Watcom.
  • CodeBlocks IDE was originally designed for the C++ language but also support other programming languages with a plugin system.
  • Has features like syntax highlighting, code folding, C++ code completion, class browser, a hex editor and many other utilities.
  • Editor supports font, size selection and custom syntax highlighting colors.
  • CodeBlocks debugger allows the user to debug their program by accessing local function symbol and argument display, custom memory dump, CPU registers, thread switching, user-defined watches, disassembly, call stack and GNU Debugger Interface.
  • Files opened are organized into tabs.
  • CodeBlocks uses custom build system storing information in XML-based project files.

Install CodeBlocks IDE on Windows

  • Visit Click Download from menu than click on download the binary release.
  • Go to your operating platform section (e.g., Windows XP / Vista / 7 / 8.x / 10) than Download the installer with GCC Compiler, e.g., codeblocks-17.12mingw-setup.exe or Click here to download.
  • Double-Click to run the downloaded installer and Click Next on pop-up window. Now Click on “I Agree” to accept license agreement.
install CodeBlocks on Windows 10
  • On new pop-up don’t do anything just click Next and then change installation directory if you want (default directory recommended). Click Install.
Install CodeBlocks on Windows
  • Wait for a minute for installation to complete. A new pop-up asks you to run Codeblocks, Click YES then it show the compiler Codeblocks detected click OK.
Compilers auto-detect
  • Now we have install Codeblocks on windows.

We need to verify Compiler and Debugger path (this step is optional).

  • Go to menu options Click on Setting >> Compiler. In Selected Compiler by default it shows GNU GCC Compiler. Now select tab “Toolchain Executables” from below tabs and Check the Compiler’s Installation Directory sets to “C:\Program Files\codeblocks\MinGW.
Verify GCC Compiler
  • Similarly, for debugger path. Settings >> Debugger >> GDB/CDB debugger >> Default . In Executable path should be C:\Program Files\codeblocks\MinGW\bin\gdb.exe or C:\MinGW\bin\gdb.exe if you have installed MinGW compiler before installing Codeblocks.
Verify Debugger

Notes: If you encountered problem running debugger with CodeBlocks do clean installation. Uninstall Codeblocks and then first install MinGW ( Go here to Install MinGW on Windows ) and then install Codeblocks.

First C/C++ Program on CodeBlocks

  • Open CodeBlocks than from menu click on File >> New >> Project.
creating new project in CodeBlocks
creating new project in CodeBlocks
  • From Pop-up click on ‘Console application’ then click on GO >> Next.
  • Select in which language (C/C++) you want to try your first program then click on Next.
console application
  • Give name to project (e.g. hellocodies) then in next column select path where you want to save your files. Then click Next.
project name
project name
Verify compiler
Verify compiler
  • On next just click finish.
  • You can see in left bar a project got created expand source than double click main.cpp or main.c to open your file. By default, a simple hello world program is written.
  • To compile program click on Build(see below screenshot), any error will be shown in below log & error tab than click on run a green play button to run program or there is also Build & run button for single click next to these two button(refer below screenshot).
Build and Run in CodeBlocks
Build and Run in CodeBlocks

Try below simple program for C and C++ to find sum of two integers.

C Example


int main(){
int a=10, b=5;

printf("Sum a+b = %d",a+b);

return 0;

// OUTPUT in C
Sum a+b = 15

C++ Example

using namespace std;

int main(){
int a=10, b=5;

cout<<"Sum a+b = "<<a+b;

return 0;
// OUTPUT in C++
Sum a+b = 15

Note: This procedure for writing your first program in CodeBlocks is same for Windows, Mac and on Linux.

Install CodeBlocks IDE on Mac OS X

Installing Codeblock on mac is single step process but more involves extra things besides downloading the file. To install Codeblock on Mac you need Xcode because Mac version it relies on Xcode distribution from Apple for its compiler.

Install Xcode on Mac

  • To install Xcode goto Appstore and enter ‘Xcode’ in search bar and click on app.
  • Click on GET and on Install App than enter your apple ID and password to download Xcode.
Install Xcode on Mac
Install Xcode on Mac
  • After download complete open the application then agrees to License agreement and Enter password to complete Xcode installation.
  • Installing just Xcode isn’t enough as we also need GCC compiler for that. Goto Apple developers site and login with your ID.
  • Search for Command line tools and download the dmg file.
  • Once download complete, you’ll get a package file (.pkg) as shown . Just double-click it and Accept all defaults to complete installation.

Let’s Install CodeBlocks now

  • Go to Click Download from menu than click on download the binary release.
  • Than go to your operating platform section (e.g., Mac OS X) than click on link opposite to to download the package or Click here to download.
  • Now extract the downloaded file and open a New Finder window than click on Application and move the extracted CodeBlocks file here (In applications).
Installing CodeBlocks on Mac
Installing CodeBlocks on Mac
  • We need authorize CodeBlocks to run. Now goto system preference >> security & privacy.
  • Now under general tab we need to click on lock pad shown below and enter password to unlock.
  • In “Allow app downloaded from” click on open anyway, a window appears showing verification process.
  • then a new window open asking to run CodeBlocks click on OPEN.
  • When first time it opens all compilers get detected you need to click on OK or you can change compiler.
  • We have successfully installed CodeBlocks on your Mac a simple program shown below to try the compiler.

Install CodeBlocks on Linux/Ubuntu

Installing codeblocks on Linux is easiest than both Mac and Windows because it is already present in package repository by default, all you need to do is just update or install stable version.

  • Open Terminal and type the following commands one by one.
sudo add-apt-repository ppa:damien-moore/codeblocks-stable
sudo apt update
sudo apt install codeblocks codeblocks-contrib
  • After the installation open Codeblocks, on first launch like mac and windows it will detect compilers present on system.
  • Select the according to your preference or leave it for default then click OK.

Leave a Reply

Your email address will not be published. Required fields are marked *