# Mac Development / GCC

**URL:** <https://boards.straightdope.com/t/mac-development-gcc/317479>\
**Category:** Factual Questions\
**Created:** [August 17, 2005, 8:52pm UTC](https://boards.straightdope.com/t/mac-development-gcc/317479 "2005-08-17T20:52:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ccwaterback](https://avatars.discourse-cdn.com/v4/letter/c/df705f/32.png) [@ccwaterback](https://boards.straightdope.com/u/ccwaterback)\
**Post date:** [August 17, 2005, 8:52pm UTC](https://boards.straightdope.com/t/mac-development-gcc/317479/1 "2005-08-17T20:52:42Z")

</div>

I have to do some task builds (is that what they call it on a Mac?). I have some instructions that include setting “environment variables” and “executing scripts” that look very much like Unix shell scripts. Eventually I will have to do builds using gcc. Can all of these things can be done on a Mac?

---

<div class="post-metadata">

**Author:** ![friedo](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@friedo](https://boards.straightdope.com/u/friedo)\
**Post date:** [August 17, 2005, 8:59pm UTC](https://boards.straightdope.com/t/mac-development-gcc/317479/2 "2005-08-17T20:59:38Z")

</div>

If we’re talking about MacOS X, yes. Under the hood it’s just BSD and your favorite shells and compilers are all there.

You may need to locate the install CD and install the Developer Tools if they’re not already on there though.

---

<div class="post-metadata">

**Author:** ![ccwaterback](https://avatars.discourse-cdn.com/v4/letter/c/df705f/32.png) [@ccwaterback](https://boards.straightdope.com/u/ccwaterback)\
**Post date:** [August 17, 2005, 9:12pm UTC](https://boards.straightdope.com/t/mac-development-gcc/317479/3 "2005-08-17T21:12:54Z")

</div>

OK, try to locate developer tools, task #1.

Thanks.

---

<div class="post-metadata">

**Author:** ![Bytegeist](https://avatars.discourse-cdn.com/v4/letter/b/9dc877/32.png) [@Bytegeist](https://boards.straightdope.com/u/Bytegeist)\
**Post date:** [August 17, 2005, 9:23pm UTC](https://boards.straightdope.com/t/mac-development-gcc/317479/4 "2005-08-17T21:23:45Z")

</div>

To expand on **friedo’s** info…

If your MacOS X version is earlier than 10.4, then the Developer Tools will be on its own CD. If you have 10.4 though (“Tiger”), then the OS and Developer Tools are all together on one DVD. (Unless you ordered separate CDs from Apple, for a machine that doesn’t have a DVD reader, but that’s a rare thing.)

You can also download the Dev Tools from Apple’s [ADC website](http://connect.apple.com), though to do so requires registration.

---

<div class="post-metadata">

**Author:** ![ccwaterback](https://avatars.discourse-cdn.com/v4/letter/c/df705f/32.png) [@ccwaterback](https://boards.straightdope.com/u/ccwaterback)\
**Post date:** [August 18, 2005, 12:37am UTC](https://boards.straightdope.com/t/mac-development-gcc/317479/5 "2005-08-18T00:37:43Z")

</div>

I did a bit of research on the Apple website. It looks like I will be able to run my Makefile(s) using bash and gcc right from the command line, at least I am hoping this is he case. I’m also using Qt for a GUI, they have a “configure” command that will create my Makefile(s) properly, hopefully. I have built this system on XP, Linux, and Solaris, so I’m hoping the Mac won’t be much more difficult than they were.

[http://developer.apple.com/unix/](http://developer.apple.com/unix/)

[http://developer.apple.com/internet/opensource/opensourcescripting.html](http://developer.apple.com/internet/opensource/opensourcescripting.html)

[http://developer.apple.com/darwin/runningX11.html](http://developer.apple.com/darwin/runningX11.html)

One sticky wicket we have is the discovery of dynamically mounted / dismounted USB disk drives. We have to implement a subsystem to notice when a new drive appears, and when an old drive disappears. Any ideas how to do this on a Mac?

Thanks again.

---

<div class="post-metadata">

**Author:** ![rjung](https://avatars.discourse-cdn.com/v4/letter/r/45deac/32.png) [@rjung](https://boards.straightdope.com/u/rjung)\
**Post date:** [August 18, 2005, 7:24am UTC](https://boards.straightdope.com/t/mac-development-gcc/317479/6 "2005-08-18T07:24:10Z")

</div>

Have you checked Apple’s online developer site? I imagine there should be a device API call or three you can use to detect USB connect/disconnect events…

---

<div class="post-metadata">

**Author:** ![Bytegeist](https://avatars.discourse-cdn.com/v4/letter/b/9dc877/32.png) [@Bytegeist](https://boards.straightdope.com/u/Bytegeist)\
**Post date:** [August 18, 2005, 2:36pm UTC](https://boards.straightdope.com/t/mac-development-gcc/317479/7 "2005-08-18T14:36:11Z")

</div>

> [@ccwaterback](#):
>
> It looks like I will be able to run my Makefile(s) using bash and gcc right from the command line, at least I am hoping this is he case.

Yes, I do those very things all the time on my own machines. Bash is automatically installed no matter what (and it’s the default shell in MacOS 10.3 and later). GCC and Make are components of the Developer Tools, and probably won’t be present if someone hasn’t installed them yet.

> [@](#):
>
> I’m also using Qt for a GUI, they have a “configure” command that will create my Makefile(s) properly, hopefully. I have built this system on XP, Linux, and Solaris, so I’m hoping the Mac won’t be much more difficult than they were.

I’d consider installing [Fink](http://fink.sourceforge.net/) or [DarwinPorts](http://darwinports.opendarwin.org/) for general Unix software management — not just for your current task, but for the future as well. They can make building third-party Unix tools a lot easier. I know Fink at least offers QT as one of their pre-configured packages. (That is, I see QT listed in their catalog; I’ve never used it myself.)

Fink also offers an “Aqua QT” package that is independent of X-Windows. I have no idea how well it works, but that sounds like a better choice if it’s equivalent. Some Mac users never install X on their machines.

> [@](#):
>
> One sticky wicket we have is the discovery of dynamically mounted / dismounted USB disk drives. We have to implement a subsystem to notice when a new drive appears, and when an old drive disappears. Any ideas how to do this on a Mac?

You might have to cross your fingers and hope that QT provides some kind of disk mount notification, or else a way to bypass the normal event queue processing. I’d look in their documentation first to see how they implement event dispatching under MacOS X. Hopefully they do tell you something about this, somewhere.

Best case: they use the **Carbon** API and registered event handlers, _or_ they use the **Cocoa** APIs, delegate objects, and overridden object methods. Worst case: they implement their own event loop; they receive disk mount events, and then ignore them, or call their own hard-wired handler. (I suppose “ignore them” counts as a hard-wired handler too, come to think of it.) If that’s their implementation, then you’re probably out of luck.

My armchair guess is that they’re using Carbon event handlers. If so, there are ‘kEventVolumeMounted’ and ‘kEventVolumeUnmounted’ events that you can request notifications for. These events don’t distinguish however between USB drives and any other kind, such as Firewire drives. You’ll have to check that device property yourself if you care about it.

There might also be some technique you could use based on the **IOKit** library, but I would be much less familiar with that approach. You’re entirely on your own if you go that route.
