To install gcc compiler on Mac OS X, you need to download and install “Command Line Tools for Xcode”, which is available in Apple’s developer page. See following steps: 1. Register Apple Developer Account. Access Apple’s developer page, to process on the download, you need to register an Apple account, it’s free, but need to spend. Download Links: Click the link below to download MinGW-w64 - for 32 and 64 bit Windows. Short details of MinGW-w64 - for 32 and 64 bit Windows: The mingw-w64 project is a complete runtime environment for gcc to support binaries native to Windows 64-bit and 32-bit operating systems. Compiler toolchain hosts natively. Supports Native TLS Callbacks. Download GCC for free. GCC - The GNU Compiler Collection includes front ends for C, C, Objective-C, Fortran, Java, Ada, and Go, as well as libraries for these languages (libstdc, libgcj. In OS X, GCC is part of Xcode's command tools, so first, open the Mac App Store and install Xcode for free. Then, open Xcode, go to Xcode menu (on the menu bar) Preferences Downloads, and install Command Line Tools. You will get commands like gcc, make, purge. Aug 19, 2013 9:48 PM. View answer in context. Question or issue on macOS: I have recently become frustrated with the new clang compiler included with Xcode 5. I was wondering what the best way to install GNU GCC on OS X would be. Things to consider: EDIT: Success! Using GCC 4.9.2 (with GMP 5.1.3, MPFR 3.1.2, MPC 1.0.2, ISL 0.12.2, and CLooG 0.18.1).
GCC is distributed via git and viaHTTPS as tarballs compressed with gzip or bzip2.
Please refer to the releases web pagefor information on how to obtain GCC.
The source distribution includes the C, C++, Objective-C, Fortran,and Ada (in the case of GCC 3.1 and later) compilers, as well asruntime libraries for C++, Objective-C, and Fortran.For previous versions these were downloadable as separate components suchas the core GCC distribution, which included the C language front end andshared components, and language-specific distributions including thelanguage front end and the language runtime (where appropriate).
If you also intend to build binutils (either to upgrade an existinginstallation or for use in place of the corresponding tools of yourOS), unpack the binutils distribution either in the same directory ora separate one. In the latter case, add symbolic links to anycomponents of the binutils you intend to build alongside the compiler(bfd, binutils, gas, gprof, ld,opcodes, …) to the directory containing the GCC sources.
Likewise the GMP, MPFR and MPC libraries can be automatically builttogether with GCC. You may simply run thecontrib/download_prerequisites script in the GCC source directoryto set up everything.Otherwise unpack the GMP, MPFR and/or MPC sourcedistributions in the directory containing the GCC sources and renametheir directories to gmp, mpfr and mpc,respectively (or use symbolic links with the same name).
Copyright (C)Free Software Foundation, Inc.Verbatim copying and distribution of this entire article ispermitted in any medium, provided this notice is preserved.
These pages aremaintained by the GCC team.Last modified 2021-07-28.
Question or issue on macOS:
I have install Mountain Lion (Mac OS X 10.8) and now gcc doesn’t seem to be available anymore. I’ve also installed Xcode 4.4 so there is no more /Developer directory.
I need gcc both for mac ports and for ruby gems (that have native extensions).
Does Xcode 4.4 include gcc or is there a way to install gcc?
How to solve this problem?
Solution no. 1:
Update:
You can now just run the following command from your terminal:
Starting with Xcode 4.3 – you must now manually install command line tools from Xcode menu > Preferences > Downloads.
Alternatively, there are stand-alone installation packages both for Mountain Lion (10.8) and for Mavericks (10.9).
This package enables UNIX-style development via Terminal by installing
command line developer tools, as well as Mac OS X SDK frameworks and
headers. Many useful tools are included, such as the Apple LLVM
compiler, linker, and Make. If you use Xcode, these tools are also
embedded within the Xcode IDE, and can be installed on your system
using the Downloads preferences pane within Xcode 4.3 and later. This
package requires Mac OS X 10.7.3 or later.
Solution no. 2:
I found that after upgrading from Lion my install was failing because it was looking for GCC in /usr/bin/gcc-4.2. Now the default installation path is /usr/bin/gcc.
My error looked like this:
A symlink will sort out the issue:
Solution no. 3:
Just paste this into terminal:
I hope that helps!
Solution no. 4:
pre-1.9.3 Ruby on Mountain Lion
Pre-requisites
Install GCC
Note, the Xcode Command Line Tools do not include GCC, they include LLVM-GCC. Same-same, but different.
Add the following to your ~/.profile or equivalent:
And reload your shell before attempting the install commands below.
Install RVM
Install Ruby
Then to set your new ruby as default:
Then check your ruby version:
Solution no. 5:
For users who can download from Apple a build of Xcode, but not the command line tools
An accepted answer to a comparable question suggests kennethreitz / osx-gcc-installer. In that ‘OSX GCC Installer’ area, the first of two options is pre-built binaries — for Snow Leopard and for Lion, but not for Mountain Lion. Considering what’s included, I should not recommend using that project’s GCC-10.7-v2.pkg after installing version 4.4 of Xcode on any build of 10.8.
The more relevant option is build your own, with reference to Apple open source for Developer Tools.
Sources for GCC, compatibility with 10.8
Apple Open Source for the most recently published Developer Tools 4.3 is without GCC. The source for GCC in the 4.1 area may be too old for use with 10.8.
GCC home page for the most recent release.
Build status for GCC 4.7 links to results for x86_64-apple-darwin10.8.0 …
Solution no. 6:
Apple provides an .mpkg installer for the Command Line Tools (CLT), but they don’t normally expose the link. It includes GCC. You can install it without downloading/installing XCode.
Solution no. 7:
You can compile it yourself with this Makefile. If you want to save yourself 2-5 hours, I created a signed installer package with GCC 4.7.2 for Mac OSX Mountain Lion which you can download here.
Solution no. 8:
You can download the installer(.pkg file) lattest version of GCC for Mountain Lion from this site. You simpy need to download and install it.
Solution no. 9:
I’m using OS X 10.9 Mavericks. I only happened to type gcc -v. The system downloaded gcc immediately. Installation completed without Xcode being installed at all. Testing “Hello, world!” works.
