Programming c or c++ on mac

5 posts / 0 new
Last post
Offline
Last seen: 17 years 5 months ago
Joined: Mar 19 2007 - 05:07
Posts: 3
Programming c or c++ on mac

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!!

Offline
Last seen: 9 years 3 months ago
Joined: Jan 12 2005 - 18:09
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/

Offline
Last seen: 17 years 5 months ago
Joined: Mar 19 2007 - 05:07
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
Jon's picture
Offline
Last seen: 13 years 6 months ago
Joined: Dec 20 2003 - 10:38
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.

Offline
Last seen: 9 years 3 months ago
Joined: Jan 12 2005 - 18:09
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.

Log in or register to post comments