Install Code Blocks on Mac OS X and run your first C program

Even though there are a lot of IDEs for Mac OS that might be better than Code blocks, I would suggest you use Code blocks to maintain compatibility as we progress through this course. But it’s not necessary. If you feel like any of the other IDEs like Xcode, Visual Studio or Eclipse is a more comfortable platform, by all means, use that. In this short tutorial, we’ll guide you to setup Code blocks on Mac OS X.

The latest Code blocks v16.01 is not available for Mac OS because, as the team behind the IDE put it, they don’t have developers to make one.

So head on to codeblocks.org and download the version that is already available. You can directly download the bundle here.

Let’s get started with the installation

Step 1: Unzip the compressed file and then launch the Code Blocks application. This should take a few seconds.

Step 2: Because of your Mac’s security, you won’t be able to install Code Blocks right away and this window will pop-up. Click okay and move on to the next step.

Step 3: In your System Preferences, you’ll find the option to override this security. Click on Security and Privacy.

We use Siteground for our hosting needs and couldn't be happier!
Sign up using our affiliate link below.


Web Hosting

Step 4:  The window will automatically show you the applications that were blocked from installing. Click on Open Anyway to resume installing Code Blocks.

Step 5: Two-level authentication. Your Mac will ensure whether you want to open it or not. Click Open.

Step 6: Once the installation resumes, and if you don’t have Xcode, you’ll be prompted by this message. Click on Get Xcode.

This will take you to the Mac AppStore. Here, after entering your Apple ID and Password you’ll be able to install Xcode for free. Depending on your Internet Speed, it could take some time to download and Install the 4.5gb application.

Step 7: Once Xcode is installed, head back over to Code Blocks and start a new project. Opt for a console application from the different templates available and select C as the language.Code Blocks on Mac OS

Step 8: Select the path where you want to save your file.

Let the compiler settings stay at their default values.

Check the management tab on the left if you can’t locate your main.c file. It should be under the Workspace drop-down. Write the HelloWorld code in the main.c file. Click on Build and Run from the toolbar and your Mac should launch the Terminal with the executed code.

If you’ve any troubles installing your new Code Blocks on Mac OS or even Windows, let us know in the comments section below and we’ll try to help you out!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 comments

  1. Hello!

    i’ve installed the code 13.12 into a macOSX 10.13.3 but it’s not compilated. It appears

    /Users/johnmoyano/Desktop/Screen Shot 2018-02-23 at 9.56.00 PM.jpg

    /Users/johnmoyano/Desktop/Screen Shot 2018-02-23 at 9.56.35 PM.jpg

    Can you hele please!

  2. Please kindly help me sort out this issue on my code block installations

    I got the code blocks and the command line tool installed but when i ran the main.cpp default hello world program, I got this on the build logs:

    ————- Run: Debug in test (compiler: GNU GCC Compiler)—————

    Checking for existence: /Users/Imesconsult/Documents/C++ Programming/test/bin/Debug/test
    Executing: osascript -e ‘tell app “Terminal”‘ -e ‘activate’ -e ‘do script “/Applications/CodeBlocks\ 2.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/Imesconsult/Documents/C++\ Programming/test/bin/Debug/test “‘ -e ‘end tell’ (in /Users/Imesconsult/Documents/C++ Programming/test/.)
    Process terminated with status 0 (0 minute(s), 0 second(s))

    and Terminal Displayed
    Last login: Fri Mar 2 15:40:35 on ttys000
    Imehs-MacBook-Pro:~ Imesconsult$ /Applications/CodeBlocks 2.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/Imesconsult/Documents/C++ Programming/test/bin/Debug/test
    -bash: /Applications/CodeBlocks: No such file or directory
    Imehs-MacBook-Pro:~ Imesconsult$ ;2D

    But when I did the verify command line tool after installations I got
    Last login: Fri Mar 2 15:43:11 on ttys001
    Imehs-MacBook-Pro:~ Imesconsult$ gcc -v
    Configured with: –prefix=/Library/Developer/CommandLineTools/usr –with-gxx-include-dir=/usr/include/c++/4.2.1
    Apple LLVM version 7.0.2 (clang-700.1.81)
    Target: x86_64-apple-darwin14.0.0
    Thread model: posix
    Imehs-MacBook-Pro:~ Imesconsult$

    Please help me so I can get started…