title: Install GNU GCC on mac
body: <p>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.</p>
  
  <p>Things to consider:</p>
  
  <ul>
  <li>I don't want to use MacPorts, fink, homebrew or any other third party package manager.</li>
  <li>I would like to use the latest GCC, compiled from source, if possible.</li>
  <li>I need the existing GCC (hardlink to clang) to remain the default, but to easily be able to use GNU GCC when I need to.</li>
  <li>I would like to avoid modifying the code if at all possible.</li>
  </ul>
  
  <p>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) I succesfully built GCC. Tips to take from here:</p>
  
  <ul>
  <li>Make sure you use ISL and CLooG. Yes, they are optional, but they make a more optimised compiler and I had trouble building without them. Make sure you use ISL 0.12, <em>not</em> the latest version (0.14).</li>
  <li>If possible, use the standalone Developer Tools, <em>not</em> XCode. (XCode has some buggy headers, and while I didn't notice any issues building GCC I have had issues with other software (e.g. GPG)).</li>
  <li>I recommend putting all your sources in the gcc directory, rather than building and installing separately (it's faster this way)</li>
  <li><em>Make sure</em> you invoke <code>configure</code> with <code>CC=clang CXX=clang++</code> so GCC knows it isn't being compiled by GCC.</li>
  <li><em>Definitely, definitely, definitely</em>, invoke <code>make</code> with <code>-j8</code>, or otherwise the build will take about 4 hours! (With <code>-j8</code>, it took 1 1/3 hours on my Mid-2012 MBP with 8gb RAM.) (<code>make -j8</code> means <code>make</code> can build 8 threads simultaneously (4 cores + HT), whereas on a 2-core machine you would run <code>make -j4</code>.) </li>
  </ul>
  
  <p>Hope this helps!</p>