Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Why not compile the version you need? – Karlson Jan 22 '13 at 21:46
@Karlson because I don't have a compiler, it's in the question :P – tkbx Jan 22 '13 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 '13 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 '13 at 2:04
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 '13 at 2:41

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.

share|improve this answer

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!

share|improve this answer
Unfortunately for this use case, bootstrapping Gentoo Prefix requires that the host already have a compiler installed. – Jonathan Callen Jan 23 '13 at 19:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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