I need to implement a Mac OS X application. In my application I need to do two things:
You can use launchd. Try man launchd and man launchd.plist.
It seems that launchd can work with USB events, even though this feature is poorly documented. I found it on: man xpc_set_event_stream_handler
Here's an example. If you put the following into: ~/Library/LaunchAgents/com.example.plist, your program should start when a USB device is connected.
Label
com.example.program
ProgramArguments
/path/to/program
LaunchEvents
com.apple.iokit.matching
com.apple.device-attach
idProduct
1234
idVendor
1337
IOProviderClass
IOUSBDevice
IOMatchLaunchStream