MacOS – How to have the Mac mount a network drive when an application launches

itunesmacmacosNetwork

I outsourced the storage for my "iTunes Media", "iTunes Music" and "Mobile Applications" using symlinks onto a network drive.

I didn't outsource the complete media library because of performance reasons with iTunes.

It would be nice to connect to my network drive when I launch iTunes as it fails less than gracefully when the network storage isn't already mounted.

Is there a way to mount a network drive prior to a particular application launching?

Best Answer

Using Automator and the excellent SleepWatcher utility, I have a setup that automatically connects to my network drive when the computer starts, then automatically reconnects when the computer wakes from sleep.

I've written a tutorial in a blog post.

An update in response to CajunLuke's question:

The Automator app connects to the network drive and incorporates a 10 second delay to ensure the network connection is ready.

SleepWatcher runs as a daemon, and allows you to schedule the execution of scripts when your computer goes to sleep or wakes from sleep. In this case you configure it to run a shell script when the computer wakes that calls the aforementioned Automator app.