I use OSX 10.10.5 need to compile some c++ code with an old version of gcc, namely 4.3.4. I don't think XCode provide that kind of tools. I suppose there is a way to do that by hand. How can I do that ?

  • Welcome to Ask Different. Are you going to make us guess your OS X version and the old gcc version you need?
    – bmike
    Sep 14 '15 at 10:38
  • @bmike I did not think it was OS specific. I have just updated my post
    – epsilones
    Sep 14 '15 at 10:50
  • next time - Consider helping us help you. Take a pass at editing this after you've read the help guide on how to be specific and show how your research didn't help you solve this dilemma.
    – bmike
    Sep 14 '15 at 11:19

I have compiled older gcc in the past as a last resort.

  1. Get Xcode - it gives you clang and lots of header files. If you can't stomach it, get the command line tools.
  2. Get http://brew.sh
  3. brew install gcc

From there you can see if an older gcc is available or worst case, pull that source and compile it from the version of gcc you have running from above. It looks like you'll be able to use homebrew to get at the version 4.3 from the versioned source already in the tool:

mac:~ me$ brew search gcc
homebrew/dupes/apple-gcc42       homebrew/versions/gcc44          homebrew/versions/gcc47          homebrew/versions/gcc5
homebrew/head-only/gccxml        homebrew/versions/gcc45          homebrew/versions/gcc48          homebrew/versions/llvm-gcc28
homebrew/versions/gcc43          homebrew/versions/gcc46          homebrew/versions/gcc49
  • I have already tried homebrew/versions/gcc43 and I get this message : ` OS X Mavericks or older is required.`
    – epsilones
    Sep 14 '15 at 11:14
  • @Newben Did you find the source of that message and look at the code? You could probably comment out the check and see what breaks. Or you'll need to just get the source and start fixing compile errors. That's the "last resort" I mentioned above.
    – bmike
    Sep 14 '15 at 11:18
  • ok thanks but I think it can be too complicated to fix it line after line, don't you think so ?
    – epsilones
    Sep 14 '15 at 11:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .