CodeBlocks on a Macintosh – Part 2

In an earlier post I had provided what I had hoped were great instructions for getting CodeBlocks to work on a Macintosh so that you can work through the examples in C++ All-In-One Desk Reference For Dummies. The instructions do, in fact, work for most people, but they don’t work for everyone. So, part of the reason for this post is to ask for your input. If you’re a Mac user who has encountered problems getting CodeBlocks to work, but solved the issue in a way that differs from my previous post, please let me know all the details about your technique (including the symptoms and step-by-step solution) at

In the meantime, I have discovered a few new pieces of information. For one thing, you can verify that you have the GNU GCC compiler installed by opening a terminal, typing gcc -v, and pressing Enter.  If GNU GCC is installed, you should see some version information along with some compiler instructions. A failure message will look something like this:

My-MacBook-Pro:~ someone$ gcc -v
-bash: gcc: command not found

If you don’t have the GNU GCC installed, there seems to be all sorts of conflicting information online on how to resolve the problem. Most of the advice suggests a rather lengthy download and installation process because apparently GNU GCC isn’t shipped with all versions of the Mac (I’m of the opinion right now that it definitely didn’t ship with any Mac OS X version prior to 10.4, which is why the download at won’t work in this instance and doing things like resetting the compiler will also result in failure.)

One of the best pieces of advice I can offer is to check the CodeBlocks Wiki for Mac-specific information. The current advice is to download the Xcode developer tools from, which apparently is a large downloadin excess of 4 GBso be prepared to do something else while you wait. I found similar advice on sites such as Tech-Recipes and the nixCraft forum. If you have a better solution, please let me know and I’ll be all too happy to share it here on my blog.

As a final note, if someone could let me know the actual installation directory for GNU GCC on the Mac, I’d really appreciate it. I understand that the installation directory is probably /usr/bin/gcc, but I’d like to be sure.


Author: John

John Mueller is a freelance author and technical editor. He has writing in his blood, having produced 117 books and over 600 articles to date. The topics range from networking to artificial intelligence and from database management to heads-down programming. Some of his current offerings include topics on machine learning, AI, Android programming, and C++ programming. His technical editing skills have helped over more than 70 authors refine the content of their manuscripts. You can reach John on the Internet at