Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
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 '13 at 2:41
show 9 more comments

2 Answers

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
add comment

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
1  
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
add comment

Your Answer

 
discard

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.