Download Code::Blocks - A powerful C and Fortran IDE with an integrated compiler that aims to meet all the requirements of even the most demanding programmers. Answered as: How do I download a GCC compiler on a Mac? The short answer is to use ‘brew' - the missing package manager. Homebrew The first line will install brew itself, the second is the brew command to install gcc. Gnu compiler mac codeblocks free download. Code::Blocks Code::Blocks is a free, open-source, cross-platform C, C and Fortran IDE built to meet the most de.
Please select a setup package depending on your platform:
NOTE: For older OS'es use older releases. There are releases for many OS version and platforms on the Sourceforge.net page.
Code Blocks is an excellent programming option for C. It consists of an open source, multiplatform integrated development environment that supports using multiple compilers, among which are: GCC (MingW / GNU GCC), MSVC, Digital Mars, Borland C 5.5 and Open Watcom. The default compiler that this Code Blocks package comes with is MinGW. Code::Blocks is a free, open-source, cross-platform C, C and Fortran IDE built to meet the most demanding needs of its users. It is designed to be very extensible and fully configurable. Finally, an IDE with all the features you need, having a consistent look, feel and operation across platforms.
NOTE: There are also more recent nightly builds available in the forums or (for Ubuntu users) in the Ubuntu PPA repository. Please note that we consider nightly builds to be stable, usually.
NOTE: We have a Changelog for 20.03, that gives you an overview over the enhancements and fixes we have put in the new release.
NOTE: The default builds are 64 bit (starting with release 20.03). We also provide 32bit builds for convenience. The 32 bit packages have either the same 64 bit compiler as the 64 bit version included or (which is recommended) a 32 bit version of the compiler.
Windows XP / Vista / 7 / 8.x / 10:
File | Date | Download from |
codeblocks-20.03-setup.exe codeblocks-20.03-setup-nonadmin.exe codeblocks-20.03-nosetup.zip codeblocks-20.03mingw-setup.exe codeblocks-20.03mingw-nosetup.zip codeblocks-20.03-32bit-setup.exe codeblocks-20.03-32bit-setup-nonadmin.exe codeblocks-20.03-32bit-nosetup.zip codeblocks-20.03-32bit-mingw-32bit-setup.exe codeblocks-20.03-32bit-mingw-32bit-nosetup.zip codeblocks-20.03-32bit-mingw-64bit-setup.exe codeblocks-20.03-32bit-mingw-64bit-nosetup.zip | 29 Mar 2020 29 Mar 2020 29 Mar 2020 29 Mar 2020 29 Mar 2020 02 Apr 2020 02 Apr 2020 02 Apr 2020 29 Dec 2020 29 Dec 2020 02 Apr 2020 02 Apr 2020 | FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net |
NOTE: The codeblocks-20.03-setup.exe file includes Code::Blocks with all plugins. The codeblocks-20.03-setup-nonadmin.exe file is provided for convenience to users that do not have administrator rights on their machine(s).
NOTE: The codeblocks-20.03mingw-setup.exe file includes additionally the GCC/G++/GFortran compiler and GDB debugger from MinGW-W64 project (version 8.1.0, 32/64 bit, SEH).
NOTE: The codeblocks-20.03(mingw)-nosetup.zip files are provided for convenience to users that are allergic against installers. However, it will not allow to select plugins / features to install (it includes everything) and not create any menu shortcuts. For the 'installation' you are on your own.
If unsure, please use codeblocks-20.03mingw-setup.exe!
Linux 32 and 64-bit:
Distro | File | Date | Download from |
codeblocks_20.03_amd64_oldstable.tar.xz codeblocks_20.03_i386_oldstable.tar.xz codeblocks_20.03_amd64_stable.tar.xz codeblocks_20.03_i386_stable.tar.xz | 29 Mar 2020 29 Mar 2020 29 Mar 2020 29 Mar 2020 | FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net | |
codeblocks-20.03-1.el6.rmps.tar codeblocks-20.03-1.el7.rmps.tar | 29 Mar 2020 29 Mar 2020 | FossHUB or Sourceforge.net FossHUB or Sourceforge.net | |
For Ubuntu, use this PPA: | 29 Mar 2020 |
Note: The Linux packages above are compressed archives (tar, tar.xz or tar.bz2). When you decompress the package you downloaded on your system, you will find all the .rpm or .deb packages required to install Code::Blocks.
Note: On RedHat/CentOS older revisions of 6 (up to 6.2 as far as we know) you need to add repoforge (former rpmforge) to your repolist, to be able to install the needed wxGTK-package. See http://repoforge.org/use for an instruction.
Note: Redhat/CentOS probably also needs an installed hunspell-package, if you want to install the contrib-plugins.
Mac OS X:
File | Date | Download from |
CodeBlocks-13.12-mac.zip | 26 Dec 2013 | FossHUB or Sourceforge.net |
NOTES:
- Code::Blocks 20.03 for Mac is currently not available due to issues caused by Apple hardening their install packages and lack of Mac developers. We could use an extra Mac developer to work on these issues.
- The provided download contains an Application Bundle (for the i386 architecture) built for Mac OS X 10.6 (and later), bundling most Code::Blocks plugins.
For older release versions please check here.
These are instructions on how to build Code::Blocks under Apple Mac OS X.They have been tested under Mac OS X version 10.4 (PowerPC and Intel),and should work similarly on the newer Mac OS X 10.5 and 10.6 as well.
We will be building everything from scratch using the source code, andnot use any available package managers likeMacPorts,Fink,Gentoo orRPM.Packaging can be done later, once it has reached a more stable release.
Update: building for MacPorts can be found at the end of the document.
- 2Check Autotools versions
- 7Build wxWidgets
- 8Bundle library for Mac
- 10Build CodeBlocks from SVN
- 11Bundle application for Mac
- 11.1Way One: Mac OS (resource)
- 11.2Way Two: NeXT (bundle)
- 13Install with MacPorts
Install Developer Tools
If they didn't come bundled with Mac OS X, get the Xcode Tools (or Developer Tools for older Mac OS X) from http://developer.apple.com/tools/ or from your install disk.
This will install Apple versions of:
- http://www.gnu.org/software/gcc/ (GNU Compilers)
- http://www.gnu.org/software/gdb/ (GNU Debugger)
- http://www.gnu.org/software/make/ (GNU Make)
Apple regularly pulls all older links in order to promote newer Mac OS X, but all theold developer tools can be downloaded from ADC at http://connect.apple.com/
You need a (free) developer registration with Apple first, in order to log in there.For Mac OS X 10.4, you want (at least) Xcode 2.2, since earlier versions were buggy.
Check Autotools versions
Depending on your OS version, you might need to download and compile new versions of these:
- http://www.gnu.org/software/autoconf/ (GNU Autoconf)
- http://www.gnu.org/software/automake/ (GNU Automake)
- http://www.gnu.org/software/libtool/ (GNU Libtool)
Check what you have, with --version (note that GNU libtool is called 'glibtool' on Mac OS X)
Currently Code::Blocks requires versions:
- autoconf 2.50+
- automake 1.7+ (1.9+ needed in order to build the dist tarball)
- libtool 1.4+ (1.5.8+ highly recommended to get some bug fixes)
Automake example
For Mac OS X 10.4, you will only need an upgraded (local) installation of automake 1.9.x.
You can download 'automake-1.9.6.tar.gz' and configure and install it with something like:
Since it's now known as 'automake-1.9', it won't interfere with the regular 'automake'
If you would rather have the new version to be called when calling 'automake', let it install into /usr/local and put /usr/local/bin before /usr/bin in your PATH.
Libtool example
Download libtool source. The following instructions will overwrite your current version of libtool with the one you just downloaded.
Note that this will replace the system version of glibtool, which might have some compatibility issues with building other software.
FYI: Universal Binaries
If you are building for Mac OS X 10.4 or later, you might want to build 'Universal Binaries 'These are binaries that contain code for both PowerPC ('ppc' arch) and Intel ('i386' arch)
The basic flags that needs to be added are:
(You only need the sysroot parameter on PowerPC Macintosh, not on a Intel Macintosh)The '-arch i386 -arch ppc' is what tells the compiler to build a 'universal' (or 'fat') binary.
Usually it's easiest to build one version for 'powerpc-apple-darwin8',and one version for 'i686-apple-darwin8', and then merge them with 'lipo'
Some caveats:
- pre-compiled headers might fail with a 'no main' error. If they do, add a -c to only compile them
- when cross-compiling, tools like auto_revision might fail to build. copy these from a native build
- the Tiger compilers might crash from time to time, but that is only to be expected (it seems)...
See Technical Note TN2137: Building Universal Binaries from 'configure'-based Open Source Projects
FYI: Compilers
When building for older versions of the SDK, you want to make sure to use the same compiler.
Mac OS X 10.6 has GCC 4.2 as the default compiler, which won't work for the Mac OS X 10.4 SDK.
FYI: ANSI or UNICODE
For the moment we are using 'ANSI' (--disable-unicode, default) for Mac OS X 10.3 and earlier,and 'UNICODE' (--enable-unicode, optional) for Mac OS X 10.4 and later.
See http://www.wxwidgets.org/manuals/stable/wx_unicode.html#unicodeandansi
FYI: 32-bit or 64-bit
Code::Blocks currently uses wxMac (wxOSX/Carbon), which is 32-bit only. So it's not possible to build for 'x86_64'.
When Code::Blocks (and requirements) has been updated to use wxOSX/Cocoa, then a 64-bit version might be built too.
Build wxWidgets
Download the source code
Download the tarball for the wxMac release:
Apply necessary patches
Don't forget to apply any released patches!
Configure and (GNU) Make
note: the easiest way to build a Universal Binary with wxWidgets isthe new flag: --enable-universal_binary (you need wxWidgets 2.6.4+)
Install into Destination
Bundle library for Mac
To avoid having the Code::Blocks user having to compile or install wxWidgets themselves,we can bundle it with our application so that it is contained in the application bundle.This could also be done by statically linking wxWidgets, but with dynamic linking we canshare the wxWidgets library between all applications using wxWidgets (not just Code::Blocks)
Way One: Library (dynamic)
To bundle our shared library with the application, we include it in 'MacOS' and change the path:
@executable_path will be replaced with e.g. /Developer/Applications/CodeBlocks.app/Contents/MacOS
Way Two: Framework (bundle)
To bundle our framework with the application, we include it in 'Frameworks' and change the path:
Compiler For Codeblocks
This way it will first look in the framework path (-F), and then in for the shared library path (-L) as usual.
Install Subversion client
On Mac OS X 10.4, you need to install the Subversion (svn) program:
Note: you need SVN for the Code::Blocks revision scripts to work!
Build CodeBlocks from SVN
Download the source code
Apply necessary patches
For a list of all available patches, see:
You might need to convert line endings from DOS to Unix first.
Bootstrap with Autotools
You need to use the newer version of automake (see above), for the 'bootstrap'. (OS X 10.5 users may have recent enough autotools so they may not need to install them)
Mono Fix
If you have the Mono.framework installed, then it probably set up a symlink like:
Unless you have a 'proper' pkg-config installation the Code::Blocks configure will fail, so move this symbolic link aside.
Configure
Note: the easiest way to build a Universal Binary for Code::Blocks is to build once for PowerPC (-arch ppc) and once for Intel (-arch i386), and then merge them (with lipo) afterwards.
Note: You need to patch the location of the pre-compiled headers, or it will generate them in the same place for both arch.
Tiger Fix
There is a bug in the glibtool of Mac OS X 10.4, that fails to link C++ libs:
To work around this, you need to edit the generated 'libtool' script manually:
This bug has been fixed in GNU libtool 1.5.8 and later.
(GNU) Make
'nice' isn't strictly needed, it just makes the compile run at a lower process priority
For the Universal Binary build:
Install into Destination
'sudo' asks you for an admin password, in order to get install permissions
For the Universal Binary build:
Where 'lipomerge' is a custom shell script:
Bundle application for Mac
After building codeblocks in the regular Unix way, you need to bundle it with the iconsand various other info that it needs to make a regular stand-alone Macintosh application.
There are two ways of accomplishing this, old Mac OS-style resource or NeXT-style bundle.The old resources are handy while developing, while bundles are more suitable for release.
Note: You need to use either of these methods, or your application will launchin the background behind all other windows and will be unable to receive any events!
Way One: Mac OS (resource)
Handy while developing, as you don't need to create a whole bundle.
First we install the program to the PREFIX directory of your choice:
Note: on the Intel Macintoshes, the icon comes up as 'broken'(apparently it assumes that all apps with resforks are Classic)
Start the application with a small prefix shell wrapper like this:
You don't need the 'DYLD_LIBRARY_PATH' stuff,if you are installing to a system directory.
Common PREFIX Settings
Local: PREFIX=/usr/local
System: PREFIX=/usr
MacPorts: PREFIX=/opt/local
Fink: PREFIX=/sw
Way Two: NeXT (bundle)
This does not involve resources, and is more relocatable.
Code Blocks For Mac
Files needed:
- codeblocks.plist (generated, rename to 'Info.plist')
- codeblocks.sh (shell wrapper, rename to 'CodeBlocks')
- app.icns (icons are available in src/src/resources/icons)
The MacOS program will just be a shell wrapper that calls 'bin/codeblocks', like above.Traditionally the bundle would include Frameworks and Resources, but we'll just avoid thosehere and use the regular 'lib' and 'share/codeblocks' instead (just as with a regular install). These temporary directories are listed in italic below, they're not really used in bundles...
Setup a hierarchy like this, and copy the files from the regular build/install and the above file list to it:
Code Blocks Can't Find Compiler
The CodeBlocks application can now be moved with the Finder, and started up like a regular Mac application. (the nightly build includes a more advanced Info.plist and more icons - for also mapping all the files that the application can open, like source code and header files and such)
Proper Application Bundling
To avoid the shell wrapper, the binary can now be moved from 'bin/codeblocks' to 'MacOS/CodeBlocks'. Helper files are moved from 'share/codeblocks' to 'Resources'. The dynamic libraries are moved from 'lib' to 'MacOS':
To avoid having to use a DYLD_LIBRARY_PATH, we rename the shared libraries (with the install_name_tool program) from e.g. /usr/local/lib/ to @executable_path/:
The libraries can have their names changed using the -id parameter:
You also need to change all of the loadable bundles for the plugins:
You can check the result, what libraries/frameworks it links to, with:
Optionally you can then repeat the process, for the wx library too...
Here is a full script to do the job... It assumes to be executed at the same directory level as the CodeBlockSVN.app directory that will receive all the stuff... maybe enhanced but it is a first try that do work when packaging an OS X SVN build.
FYI: Darwin vs. Mac OS X
'Darwin is the UNIX technology-based foundation of Mac OS X.'
'Pure Darwin' here refers to the Open Source version of the OS:
- http://puredarwin.org/ or http://gnu-darwin.sourceforge.net/
(that is: Darwin using X11 instead of Aqua for the user interface)
Install with MacPorts
Install wxWidgets
You will need the wxWidgets library, install as port with:
If you want the X11/GTK version on Mac OS X, instead use:
Install Code::Blocks
After that is installed, you can install Code::Blocks with:
If you want the X11/GTK version on Mac OS X, instead use:
This will download the SVN trunk, and any dependencies:
If you would rather have the new version to be called when calling 'automake', let it install into /usr/local and put /usr/local/bin before /usr/bin in your PATH.
Libtool example
Download libtool source. The following instructions will overwrite your current version of libtool with the one you just downloaded.
Note that this will replace the system version of glibtool, which might have some compatibility issues with building other software.
FYI: Universal Binaries
If you are building for Mac OS X 10.4 or later, you might want to build 'Universal Binaries 'These are binaries that contain code for both PowerPC ('ppc' arch) and Intel ('i386' arch)
The basic flags that needs to be added are:
(You only need the sysroot parameter on PowerPC Macintosh, not on a Intel Macintosh)The '-arch i386 -arch ppc' is what tells the compiler to build a 'universal' (or 'fat') binary.
Usually it's easiest to build one version for 'powerpc-apple-darwin8',and one version for 'i686-apple-darwin8', and then merge them with 'lipo'
Some caveats:
- pre-compiled headers might fail with a 'no main' error. If they do, add a -c to only compile them
- when cross-compiling, tools like auto_revision might fail to build. copy these from a native build
- the Tiger compilers might crash from time to time, but that is only to be expected (it seems)...
See Technical Note TN2137: Building Universal Binaries from 'configure'-based Open Source Projects
FYI: Compilers
When building for older versions of the SDK, you want to make sure to use the same compiler.
Mac OS X 10.6 has GCC 4.2 as the default compiler, which won't work for the Mac OS X 10.4 SDK.
FYI: ANSI or UNICODE
For the moment we are using 'ANSI' (--disable-unicode, default) for Mac OS X 10.3 and earlier,and 'UNICODE' (--enable-unicode, optional) for Mac OS X 10.4 and later.
See http://www.wxwidgets.org/manuals/stable/wx_unicode.html#unicodeandansi
FYI: 32-bit or 64-bit
Code::Blocks currently uses wxMac (wxOSX/Carbon), which is 32-bit only. So it's not possible to build for 'x86_64'.
When Code::Blocks (and requirements) has been updated to use wxOSX/Cocoa, then a 64-bit version might be built too.
Build wxWidgets
Download the source code
Download the tarball for the wxMac release:
Apply necessary patches
Don't forget to apply any released patches!
Configure and (GNU) Make
note: the easiest way to build a Universal Binary with wxWidgets isthe new flag: --enable-universal_binary (you need wxWidgets 2.6.4+)
Install into Destination
Bundle library for Mac
To avoid having the Code::Blocks user having to compile or install wxWidgets themselves,we can bundle it with our application so that it is contained in the application bundle.This could also be done by statically linking wxWidgets, but with dynamic linking we canshare the wxWidgets library between all applications using wxWidgets (not just Code::Blocks)
Way One: Library (dynamic)
To bundle our shared library with the application, we include it in 'MacOS' and change the path:
@executable_path will be replaced with e.g. /Developer/Applications/CodeBlocks.app/Contents/MacOS
Way Two: Framework (bundle)
To bundle our framework with the application, we include it in 'Frameworks' and change the path:
Compiler For Codeblocks
This way it will first look in the framework path (-F), and then in for the shared library path (-L) as usual.
Install Subversion client
On Mac OS X 10.4, you need to install the Subversion (svn) program:
Note: you need SVN for the Code::Blocks revision scripts to work!
Build CodeBlocks from SVN
Download the source code
Apply necessary patches
For a list of all available patches, see:
You might need to convert line endings from DOS to Unix first.
Bootstrap with Autotools
You need to use the newer version of automake (see above), for the 'bootstrap'. (OS X 10.5 users may have recent enough autotools so they may not need to install them)
Mono Fix
If you have the Mono.framework installed, then it probably set up a symlink like:
Unless you have a 'proper' pkg-config installation the Code::Blocks configure will fail, so move this symbolic link aside.
Configure
Note: the easiest way to build a Universal Binary for Code::Blocks is to build once for PowerPC (-arch ppc) and once for Intel (-arch i386), and then merge them (with lipo) afterwards.
Note: You need to patch the location of the pre-compiled headers, or it will generate them in the same place for both arch.
Tiger Fix
There is a bug in the glibtool of Mac OS X 10.4, that fails to link C++ libs:
To work around this, you need to edit the generated 'libtool' script manually:
This bug has been fixed in GNU libtool 1.5.8 and later.
(GNU) Make
'nice' isn't strictly needed, it just makes the compile run at a lower process priority
For the Universal Binary build:
Install into Destination
'sudo' asks you for an admin password, in order to get install permissions
For the Universal Binary build:
Where 'lipomerge' is a custom shell script:
Bundle application for Mac
After building codeblocks in the regular Unix way, you need to bundle it with the iconsand various other info that it needs to make a regular stand-alone Macintosh application.
There are two ways of accomplishing this, old Mac OS-style resource or NeXT-style bundle.The old resources are handy while developing, while bundles are more suitable for release.
Note: You need to use either of these methods, or your application will launchin the background behind all other windows and will be unable to receive any events!
Way One: Mac OS (resource)
Handy while developing, as you don't need to create a whole bundle.
First we install the program to the PREFIX directory of your choice:
Note: on the Intel Macintoshes, the icon comes up as 'broken'(apparently it assumes that all apps with resforks are Classic)
Start the application with a small prefix shell wrapper like this:
You don't need the 'DYLD_LIBRARY_PATH' stuff,if you are installing to a system directory.
Common PREFIX Settings
Local: PREFIX=/usr/local
System: PREFIX=/usr
MacPorts: PREFIX=/opt/local
Fink: PREFIX=/sw
Way Two: NeXT (bundle)
This does not involve resources, and is more relocatable.
Code Blocks For Mac
Files needed:
- codeblocks.plist (generated, rename to 'Info.plist')
- codeblocks.sh (shell wrapper, rename to 'CodeBlocks')
- app.icns (icons are available in src/src/resources/icons)
The MacOS program will just be a shell wrapper that calls 'bin/codeblocks', like above.Traditionally the bundle would include Frameworks and Resources, but we'll just avoid thosehere and use the regular 'lib' and 'share/codeblocks' instead (just as with a regular install). These temporary directories are listed in italic below, they're not really used in bundles...
Setup a hierarchy like this, and copy the files from the regular build/install and the above file list to it:
Code Blocks Can't Find Compiler
The CodeBlocks application can now be moved with the Finder, and started up like a regular Mac application. (the nightly build includes a more advanced Info.plist and more icons - for also mapping all the files that the application can open, like source code and header files and such)
Proper Application Bundling
To avoid the shell wrapper, the binary can now be moved from 'bin/codeblocks' to 'MacOS/CodeBlocks'. Helper files are moved from 'share/codeblocks' to 'Resources'. The dynamic libraries are moved from 'lib' to 'MacOS':
To avoid having to use a DYLD_LIBRARY_PATH, we rename the shared libraries (with the install_name_tool program) from e.g. /usr/local/lib/ to @executable_path/:
The libraries can have their names changed using the -id parameter:
You also need to change all of the loadable bundles for the plugins:
You can check the result, what libraries/frameworks it links to, with:
Optionally you can then repeat the process, for the wx library too...
Here is a full script to do the job... It assumes to be executed at the same directory level as the CodeBlockSVN.app directory that will receive all the stuff... maybe enhanced but it is a first try that do work when packaging an OS X SVN build.
FYI: Darwin vs. Mac OS X
'Darwin is the UNIX technology-based foundation of Mac OS X.'
'Pure Darwin' here refers to the Open Source version of the OS:
- http://puredarwin.org/ or http://gnu-darwin.sourceforge.net/
(that is: Darwin using X11 instead of Aqua for the user interface)
Install with MacPorts
Install wxWidgets
You will need the wxWidgets library, install as port with:
If you want the X11/GTK version on Mac OS X, instead use:
Install Code::Blocks
After that is installed, you can install Code::Blocks with:
If you want the X11/GTK version on Mac OS X, instead use:
This will download the SVN trunk, and any dependencies:
How To Install Codeblocks Compiler
Note: to upgrade from SVN, you need to uninstall first:
This is both because all SVN versions are numbered '0',but also due to a bug in the Code::Blocks build scripts.
Running +aqua (wxMac) version
After the build completes, you can start the program by:
Note that the wxMac application bundle in 'MacPorts'is just a wrapper, with symbolic links to /opt/local...
Running +x11 (wxGTK) version
The non-bundled wxGTK version is instead started with:
Code Blocks Compiler Mac Download Windows 10
When running X11/wxGTK programs in Mac OS X, you can use'open-x11' to first start up X11.app and set up $DISPLAY: