I'm running OSX, and I don't have root, or an existing compiler. Is there any way I can install gcc?

  1. Are there official or trusted unofficial mach-o binaries that can be downloaded for a certain version of OS X?

  2. If so, can said binaries be installed to ~/bin and work properly?

  • Why not compile the version you need?
    – Karlson
    Jan 22, 2013 at 21:46
  • 1
    @Karlson because I don't have a compiler, it's in the question :P
    – tkbx
    Jan 22, 2013 at 22:09
  • Do you have access to a different machine? If you are really desperate you could compile on a different one and move the result over. Even cross compilation from a different unix might be possible, but i'd recommend rebuilding the toolchain afterwards. There are certainly free gccs to be had on the internet for the latest OSXs (for example hpc.sourceforge.net/index.php) but if i recall correctly those have hard coded /usr/local paths and worse, you still don't have binutils and I don't believe there is a source other than the xcode bundle.
    – Max
    Jan 23, 2013 at 1:32
  • @Max I have access to Linux. Is there a way to build a binary for mach-o on Linux?
    – tkbx
    Jan 23, 2013 at 2:04
  • 2
    There are a handful of crosscompiling guides out there. devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt This looks somewhat promising, albeit painful. If there is any way to get your admin to just install xcode for you, I'd recommend that. This will not be easy.
    – Max
    Jan 23, 2013 at 2:41

2 Answers 2


You can download the gcc precompiled binaries from here: https://github.com/kennethreitz/osx-gcc-installer

They come as a pkg, you can follow the instructions here: "How can I open a .pkg file manually?" to install the pkg as an unprivileged user.


You may try something like Gentoo Prefix for Mac OS X, which allows you to bootstrap a Gentoo environment under your home directory (or anywhere else you may want it where you have read/write/execute permissions).

From the description:

Gentoo Prefix runs unprivileged, meaning no root user or rights are required to use it.

Just a note though - I have never personally gotten this to work (it failed a few times and I lost patience). However, I do know it is actively maintained and bug reports are usually replied to very quickly. The IRC channel is also quite helpful.

Good luck!

  • 2
    Unfortunately for this use case, bootstrapping Gentoo Prefix requires that the host already have a compiler installed. Jan 23, 2013 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.