Programming c or c++ on mac

4 replies [Last post]
Offline
Joined: Mar 19 2007
Posts: 3

im new to macs as i have recently got one and i just cant seem to find a C compiler for it whatever i download is usually a .tar.gz file which when i unarchive i cant find the application. so can u guys help me ? and giv me the names of a couple of small sized free C compilers which i can download and the steps of how to finally get it to work?
THANX!!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Offline
Joined: Jan 12 2005
Posts: 104
OS X? Developers Tools?

Are you using OS X, and if so, have you installed the Developers tools that come with it? If so, you should have a whole bunch of compilers installed already (gcc, and/or g++).

http://developer.apple.com/tools/

__________________

Dustin

Offline
Joined: Mar 19 2007
Posts: 3
i dont have gcc

can u help me in any other way ?
as i said all filew down load a .tar.gz and then i cant find the .app after unarchiving

Jon's picture
Jon
Offline
Joined: Dec 20 2003
Posts: 2804
When you download Xcode (the

When you download Xcode (the Apple supplied dev sftware, 900+MB) gcc is included. It downloads as a .DMG file.

__________________

I am not in this world to live up to other people's expectations, nor do I feel that the world must live up to mine. - Fritz Perls

Offline
Joined: Jan 12 2005
Posts: 104
not a .app

Most likely, a compiler will be a program that you access from the Terminal, or through a developement environment (such as Apple's Xcode). So you want to open the Terminal (Applications/Utilities/Terminal.app), and untar the tarball by typing in the command tar xfzv $TARBALL_NAME_HERE in the directory that you have it stored in, and if you list the directorie's contents with ls -F, executable tools will show up in the resulting list with a '*' appended to the end, and you can run the tool by typing in ./$TOOLS_NAME_HERE "./" makes sure that the terminal searches the current directory for programs to run, and not just the installed search paths for tools.

I'm hoping/assuming, since youu said you unarchived a tar.gz, and can't find the .app, that you have actually a bunch of files, but just didnt' recognize any of them as executable? If so, looking in the finder, the executable terminal tools look like little dark grey squares that are meant to look like little terminals, with "exec" printed in green on them, if you make the icon size huge to see it.

You're best bet is to just get the XCode environment, though, since it will have a .app, a nice, double clickable program, to get you started, and more often than not .tar.gz files are source code tarballs, that you have to build yourself, usually with the commands "./configure;make;sudo make install", which you'll need gcc installed for, that comes with Xcode developers tools.

__________________

Dustin