Much of the API and Maccish world is actually quite well integrated with the command line Unix world. As a trivial example "say" in the terminal fires up the Cocoa speech synthesis engine and by default pipes it out over the current CoreAudio device. Just the surface though. You can trigger anything you can in AppleScript and so on. Some time with the man pages can pay off.