How to install CodeBlocks on Mac?


Code::Blocks is a free, open source cross-platform IDE (Integrated Development Environment) which works alongside compilers such as GCC, Visual C++, and Clang. It is currently oriented towards just a few fundamental programming languages: C, C++, and Fortran.

CodeBlocks is supported by Windows, Mac OS X, and Linux. Its latest version, as of this writing, was released on Dec 27, 2013.

Now, introduction aside, I guess you already know what CodeBlocks is. You might have used it easily on Windows to write C/C++ programs; there it wasn’t much of a problem to use the IDE on Windows.

If you’re trying to get CodeBlocks up and running on Mac OS X, then there are few extra things you need to do besides downloading the CodeBlocks file. In this post, I’ll guide you through a step-by-step procedure to install CodeBlocks on Mac.

The Mac version of CodeBlocks relies on Xcode distribution from Apple for its compiler. So, the installation requires setting up of 3 different parts:

1. Installing Xcode:

The first thing you need to do is download Xcode from App Store. Just go to App Store, sign up if you need to, and search for Xcode. The file you’re looking for is this shown below; it is the first item in the search result.

Install CodeBlocks on Mac - Xcode

The Xcode file is large – around 2.5GB. Here it says “open” because I’ve already installed it on my Mac. On your Mac, it may say “get” or “free” underneath the icon.

Just click on it, and install it, accepting all the defaults and entering your system password when required. The downloading and installation procedure may take some time. (The version I’ve installed is Xcode 6.1.1.)

2. Installing CodeBlocks:

In the second part, you need to download and setup CodeBlocks for Mac. Go to this page. Click on Download the binary release, and select Mac OS X. Then, download CodeBlocks from any of these two mirror links.

Install CodeBlocks on Mac - Download Code::Blocks

This is a zip file of around 30MB. Once you’ve downloaded it, upzip it and you’ll get a CodeBlocks app file. Now to install this, simply “drag and drop” that file into Applications folder.

If you’ve never installed an application on your Mac from a third-party site before, you will need to make a change to allow your system for such installations. For this go to System Preferences > Security & Privacy.

Click the lock to make changes, and click on Allow apps downloaded from: Anywhere as shown below. (You can revert to your original settings once you’ve installed CodeBlocks.)

Install CodeBlocks on Mac - System Preferences

3. Installing Command Line Tools:

After you’ve installed Xcode and CodeBlocks, there’s one more thing to do – installing the command line tools. If you just do the above two steps, you can write as much code as you want, but they won’t compile!

This is because you still don’t have a working GCC compiler on your Mac. Command Line Tools allow you to call the compilers from the command line.

Now, go to the Apple Developer download page. First, you may need to log in using your Apple ID, and then you may also be asked to sign up for Apple Developer ID which is free.

You’ll come across a page like this. Click on Command Line Tools for Xcode, and download the dmg file. (This file is 170MB as of now.)

Install CodeBlocks on Mac - Download Command Line Tools

Once you’ve downloaded it, you’ll get a package file (.pkg) as shown above. Just double-click it and it will install the Command Line Tools. Accept all defaults.

Then, everything’s set; you’re ready to write your first program using CodeBlocks on Mac. Open CodeBlocks, copy-paste this sample C++ code and click on Build and Run.

This will open the Terminal and print “I’m using CodeBlocks on Mac!” as shown below.

Using Code::Blocks on Mac

Well, that’s it – making CodeBlocks run on Mac OS X requires just downloading and installing of Xcode, CodeBlocks itself, and Command Line Tools. If you encounter any problems, or have any questions, bring them up from the comments.


Please enter your comment!
Please enter your name here