Mac OSX uses clang instead of gcc as the default C compiler. We can manually compile and install gcc in OSX.


  • GMP: GNU Multiple Precision Arithmetic Library
  • MPFR: Multiple-Precision Floating-point computations with correct Rounding
  • MPC: C library for the arithmetic of complex numbers

Install GMP and MPFR by homebrew

brew install gmp mpfr

Install MPC by source code

(the mpc version in homebrew is too old)

tar zxf mpc-1.0.2.tar.gz
cd mpc-1.0.2
sudo make install

Install gcc

There seems to be some problem in 4.9.0

tar jxvf gcc-4.8.1.tar.bz2
cd gcc-4.8.1
./configure --prefix=/usr/local/gcc --enable-languages=c,c++
make DESTDIR=/usr/local/gcc BOOT_CFLAGS='-O' bootstrap
sudo make install