josh
josh

Reputation:

Mac OS X free C compiler

Is there a small, free C or C++ compiler for OS X, like TCC?

Xcode is not small, or simple like TCC, AFAIK.

I'm looking for something like a GCC binary file or TCC for OS X.

Upvotes: 11

Views: 18679

Answers (7)

Matt K
Matt K

Reputation: 13852

There are binary packages for LLVM, both for the Clang and GCC front-ends.

Upvotes: 3

Pratik
Pratik

Reputation: 11

PCC, the Portable C Compiler, is available for the Mac. It is small and free. Its tarball weighs in at total of 1778 KB from its 4th of July CVS Snapshot.

Upvotes: 1

Matthew Scharley
Matthew Scharley

Reputation: 132254

gcc is the most widely used one (and Apple provides official builds of it as part of XCode). XCode is also usually distributed on your OS X cd's, though that version may be a little out of date now, depending on what version of OS X you have.

For information and samples on how to use it, look here.

Look into Fink or one of the similar projects out there if you want a build of gcc that's not linked to Xcode. That said though, Xcode is a great IDE for OS X.

Upvotes: 31

Frank V
Frank V

Reputation: 25419

I know you want a small compiler, but it is best to just download and install Xcode. It is a great IDE. From there, you don't have to use it if you don't want to. Once it is installed, you can use something like this in terminal:

gcc myFile.c -o myFile

And that would build a source file called myFile.c which contains C code and the output module (executable) would be myFile. You'd execute it by running:

./myFile

Update: What is your reason for not wanting Xcode? Furthermore, is GCC itself ok (disregarding Xcode for a moment)? It's important to know that GCC is not a part of Xcode. Apple made use of GCC, which is an open source C/C++ (and more) compiler.

I just can't find binaries of GCC for mac so downloading Xcode is an easy way to get some...

Update 2: It also just came to my attention that NetBeans will compile C / C++ Code. It also uses the GCC compiler. I'm not sure if it using GCC from my Xcode installation but I thought I'd mention this.

Best Regards,
Frank

Upvotes: 3

Janusz
Janusz

Reputation: 189464

If you don't want to use Xcode install the macports from macports.org and if you like a graphical user interface install porticus as a managment gui for all the installed ports. In Porticus you can now easily install all different versions of gcc without Xcode. Porticus will compile the packages for your mac and install all the needed dependencies like a Linux packet manager.

Upvotes: -1

theCakeCoder
theCakeCoder

Reputation: 1148

You can use Code::Blocks IDE its simple slick and hav good set of feture, a plus opensurce and ready to dl for 3 major plateforms

still recoment using Xcode if u just have to make projects for MAC, but if u are going to port it to linux and windows, then my choice is Code::Blocks [Give it a try atleast]

Upvotes: 4

Louis Davis
Louis Davis

Reputation: 784

You could use the Xcode Tools that are already included in OSX.

Xcode is the same professional developer toolset used by Apple to create Mac OS X, as well as many great Apple applications, and Xcode is included with every copy of Mac OS X.

Upvotes: 3

Related Questions