tags:

views:

4048

answers:

6

I've googled the hell out of it, and it seems like there is no way to install gcc on OS X without installing Xcode (which takes at leats 1.5GB of space). All I need is gcc and none of the other junk that comes with Xcode. And at this point, I'll take any other kind of C compiler.

I know I could simply install Xcode, but that is beside the point since I neither have my original installation disc nor a quick internet connection.

So... does anyone have any suggestions?

EDIT: Sorry if I was unclear, but I need the headers as well. I'm currently installing gcc4 via fink and it's downloading the shared libraries as well. I'll update on the progress.

EDIT 2: Ok, so I successfully installed gcc using fink. BUT, it's pretty much useless: "error: C compiler cannot create executables". After googling around, I found that not having Apple's Developer Tools installed is the cause of the error. Probably because I need all the libraries, headers, etc that are only available through Xcode.

+2  A: 

There's fink and MacPorts, if you want an easy installer/updater.

eduffy
Both MacPorts and fink require Developer Tools (Xcode).
aryo
Not macports, which requires Xcode, since it compiles every package. See http://www.macports.org/install.php .
freespace
No, fink can be restricted to binary only, so it doesn't require a working compiler unless you want to go outside binary packages. Whether or not gcc is available as a binary package, I don't know.
freespace
http://pdb.finkproject.org/pdb/package.php/gcc42 - looks like a binary version is available for OS X 10.5.
Daniel James
Why does this have 3 points? Not to put to fine a point on it, the answer is quite wrong. Both Macports and Fink list XCode as a pre-requisite for installation:http://www.macports.org/install.phphttp://www.finkproject.org/doc/bundled/install-first.php
Mike Heinz
Yes, the docs say that, but I can tell you _from experience_ fink _can work without a compiler_. As it says on the downloage page: "You may find that only using binary packages limits the utility of Fink... To build packages from source, you will need to install the Developer Tools..."
freespace
+1  A: 

I'm fairly certain that this is not possible. However, I'm also not sure if you need the whole developer suite to get the developer tools installed. Quite a few tools get installed along with XCode that might be optional. However, I think you're out of luck for not needing to bite the bullet and use wget or DownThemAll or some other download manager that will let you slowly download the developer tools in chunks.

Whenever I install OS X I install the developer tools as a rule, just because it opens up the world of available software tremendously. Perhaps you should consider doing this in the future as well.

Tim Visher
A: 

Install the GCC package from the Packages directory in Xcode's disk image and you'll have just GCC. Note that of course you won't have autotools or other standard build tools, for which you will have to install more packages from that folder.

millenomi
A: 

I found this googling around that appears to install it without XCode.

brian
... You needed to read a little further in that article - that was an article on how to compile and install a newer GCC on top of the GCC that Apple was shipping in 2002, it does not permit installing a compiler without XCode.
Mike Heinz
+1  A: 

The first thing you want to try is called Pacifist - what Pacifist lets you do is to open a large package (such as XCode) and to access parts of it directly. I'm pretty sure you'll be able to find a smaller package inside the XCode package that just has gcc.

HOWEVER it's not clear to me that this is the best route. If you are planning to do Cocoa or Carbon developing I strongly suggest installing the entire package because you will need all the documentation and headers. If you're only planning on doing command-line stuff, you still may find you need to poke around inside XCode to identify all the packages you will need - things such as libraries, headers, man pages and so on.

All in all you're probably still better off installing the whole thing - if HD space is really tight (because you're on a tiny old iMac for example) then look at tools like Monolingual - Monolingual removes all the international support from all the various OS X applications, which can easily reduce the size of an application by 50%.

Mike Heinz
I believe you are correct as well, sir. By the way, thanks for recommending Monolingual.
aryo
A: 

I've been doing this for a long time, and I've done things like this, and I've concluded it's simply never worth doing. :-(

The reason is that no one expects you to do such things, so there are assumptions all over the system that "everything" is there. You might not run into this today - or worse, you might not even realize later that this is the cause of your issues.

Instead of wasting your smart time on things like this which don't actually produce any working code you can use, following the approved method, run the download overnight, and spend your time instead on planning and writing the top-level code (you shouldn't need a compiler for that anyway!)

Tom Swirly