Industry guru Dave Taylor offers tech support on technical and business topics, including iPhone, iPod, Microsoft Windows, Sony PSP, cellphones, online advertising, CSS, Web design, business, Unix, Linux, SEO, Mac OS X, and shell script programming.     


How do I install Apple Developer Tools on my Mac?

I seem to recall a long time ago that when you installed Mac OS X you also got a bunch of cool Unix command line developer tools, including a C compiler, debugging tools and much more. I'm taking a C programming class at the local community college and would like to install these tools, but have no idea where they are any more. Help?


Dave's Answer:

Ah yes, join us now as we travel back in time and visit the software development environment of yesteryear, the Unix command line. Thrill as we see obfuscated error messages from the C compiler, gasp as we come face to face with "vi" and weep in anticipatory frustration as we try to use "gdb" to figure out what the heck's wrong with our simple "hello world" application.

Actually, I have always enjoyed programming in C and have written some quite massive applications in the language. I still dabble in the language, actually, as I find it to be fast, flexible and logical for tasks that can't be forced into a shell script template. I tried object-oriented programming and was even a professional LISP programmer for a while, but never quite wrapped my brain about the concept.

Anyway, Apple does include a C development environment - and quite a bit more - with every copy of Leopard, along with earlier versions of Mac OS X, but truth be told, you need to know one key thing: the Apple development environment toolset is called Xcode.

Now you can drop your install (or restore) disk into your drive and know how to proceed. I am going to be working off an original Leopard OS, but XCode is included with all modern releases of Mac OS X, as far as I am aware.

When you open up the install DVD, you'll see that in addition to the cool "Install Mac OS X" icon, there's also a folder labeled "Optional Installs". That's what you want.

Within there's an icon labeled "Optional Installs.mpkg". That's not what you want, so don't click on it. Instead, go into the folder "Xcode Tools", where you'll see three installers: "Dashcode.pkg", "WebObjects.mpkg" and "XcodeTools.mpkg".

Double-click on "XcodeTools.mpkg" to get started.

Get past the license agreements (yawn) and click on "Customize" and you'll see what's about to be installed:

Mac OS X: Install Xcode Tools

The key one to ensure you have selected is "UNIX Development Support" which gives you access to all the handy commands and tools you seek.

Given that you aren't developing Mac applications with a GUI but want to just experiment with the C language, I suggest that you unselect "Core Reference Library", which is described by Apple as:

"An Xcode documentation set consisting of Apple's Mac OS X and Developer Tools technical resources, including Guides, Reference, Release Notes, Sample Code, Technical Notes, and Technical Q&As. This content is relocatable and placed inside a location chosen by the user (default is /Developer on the boot volume)."
After dropping that off the list, it's still a fairly substantial installation of 1.9GB, but I have a sense we can prune that down further once everything's added, which I'll do by clicking on "Install".

About ten minutes later, it's installed and I quit the install program and open up, of course, a Terminal window (Applications -> Utilities -> Terminal.app) and immediately move to "/Developer" to see what's new:

$ cd /Developer
$ ls
About Xcode Tools.pdf Headers/ SDKs/
Applications/ Icon? Tools/
Documentation/ Library/ usr/
Examples/ Makefiles/
Extras/ Private/

We could dig into things and prune down the installation at this point, as shown here:

$ du -sh *
84K About Xcode Tools.pdf
182M Applications
378M Documentation
148M Examples
3.0M Extras
1.8M Headers
169M Library
1.2M Makefiles
148K Private
353M SDKs
256K Tools
149M usr

but, really, let's get into playing with the tools instead. Far more fun.

It turns out that all the tools are tucked into "/Developer/usr/bin". Go there and you'll find all your favorite developer apps, from ar and cpp to cvs, flex, gcc (the key app: that's the GNU C compiler), lex, m4 and, oh, so many more tools that will bring a tear of joy to your geeky command line eye. :-)

And so, a simple C program:

#include <stdio.h>

main()
{
  printf("Aloha, bruddas!\n");
}

Compiled and run:

$ gcc aloha.c -o aloha
$ ./aloha
Aloha, bruddas!
$

Now we're rockin'. At least, in an old-school programmer geek sense. :-)


More Useful Mac OS X Help Articles:
✔   Audacity can't find LAME library, I can't save Mp3?
Hey Dave. I read your article Audacity can't save mp3 audio files and am still puzzled because I downloaded the LAME Mp3 converter...
✔   How to remove Dashboard as a "space" in Mac OS X Spaces?
I'm a big fan of the Spaces utility in Mac OS X that lets me have multiple virtual screens [see Set Up Mac...
✔   Best place to buy a cheap MacBook laptop?
Hi Dave. I am looking for two gently used MacBook laptops for my teen daughters. Personal computers would greatly facilitate their studies as...
✔   File too big error copying to USB flash drive on my Mac?
I'm baffled. I have a 16GB Kingston USB flash drive that I use on my Mac system and I'm trying to copy a...
✔   Stealth image capture photo from webcam on my Mac?
Someone sneaks into my cubicle while I'm at lunch and takes candy out of my desk. Petty, but stupid too. I want to...

Let's stay in touch!
Sign up for my weekly AskDaveTaylor Newsletter and you'll receive even more tech and gadget help right to your inbox, along with exclusive news and industry updates. It's good stuff. I promise!
    Enter your name: and your email addr:  





Categorized: Mac OS X Help   (Article 7927, Written by )
Tagged: c, c++, gnu project, linux, objective c, software development, unix
Previous: How do I install Vista in VMWare Fusion?
Next: VMWare Fusion won't run on my Macbook Air?




Reader Comments To Date: 6

Andrea Belvedere said, on July 2, 2009 5:16 PM:

Thanks Dave for your great tutorials, I just like to point out that it is also possible to download the developer tools from here: http://developer.apple.com/

Oscar said, on April 22, 2010 12:33 PM:

Hello.


Google bought me here.

I installed Xcode without UNIX support long time ago, and now I'm trying to add it, but when I run the installer it is disable.


Is there something I can do about it?

Thanks in advance.

Carlos said, on April 27, 2010 6:45 PM:

After Googleing and reading Apple carefully I just found the answer:

If the "Unix Development Support" option is disabled, it's because you have the WRONG version of XTools for the MacOS X that now you have. For example if you have updated to Snow Leopard, then the XCode 3.1 does NOT be able to install the "Unix Development Support", so to fix this problem download the XCode 3.2 or other newer version that supports your Mac OS X version.

Aileen said, on May 1, 2010 3:22 PM:

This was a wonderful reference tool for me--I'm using my boyfriend's Mac for my intro to C++ class and had no clue how to go about installing Xcode.

This is definitely easier than going through the apple developer site....thank you so much!!

Aram Madigan said, on May 7, 2010 1:00 AM:

my mac osx install disc installs Xcode 3.0 onto my computer when i run it but when installing macports Wine the installer says i need Xcode 3.1 but i can't find any way to update from 3.0 - 3.1 without redownloading the whole thing again and i can't download the whole 950 mb file over my iphone as modem.
Is it possible to update from 3.0 to 3.1?

MR.Tao said, on December 1, 2011 12:13 AM:

It works! Thanks for the detailed info.

Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you, Dave, for all your helpful information by buying you a cup of coffee!

I do have a comment, now that you mention it!











I will never send you any unsolicited email. Ever.






Check This Out Too...

 
Look for Answers
Need Help? Ask Dave Taylor!


Follow Me on Pinterest

Find Me on Google+
ADT on G+
© 2002 - 2013 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site. Further, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site. My lawyer says "Thanks".
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.