Automatically Mounting Network drives in OS X

Despite being a multi-user UNIX based operating system OS X doesn't make it particularly easy to automatically mount network shared drives at login. The common solution is to mount the drives through Finder and then drag the mounted drive into the Login Items for the individual user. Whilst this works OK, everytime you login you end up with a bunch of Finder windows opening up.

A much nicer way to achieve the same thing is with the following AppleScript:

set mount_point_list to {"documents", "music", "photos"}

repeat with mount_point in mount_point_list
	try
		log "mounting " & mount_point
		mount volume "afp://<server>/" & mount_point
			as user name "<username>" with password "<secret>"
	end try
end repeat

Copy this into the AppleScript editor (CMD-Space, then type AppleScript to find it).
Change the mount_point_list contents to suit your situation also replace <server>, <username> and <secret> as appropriate.

If you are working with Windows network drives you can replace the afp:// with smb://.

Save the AppleScript as an Application and then add the saved application to your login items in System Preferences.

Related Article