Was asked today how to mount some NFS file systems at boot-time on a Mac. Now, usually with UNIX we would do an rc script or somesuch, , however for Mac OS X things are a little different.

Though I am aware that there are other ways to do this, and I know we could use the automounter too, I do follow the KISS (Keep It Simple Stupid) principle, and this is a great little nugget I found on the t’interweb.

Create the script you want to run at boot-time, lets say /usr/local/bin/mount_nfs.sh and chmod u+x it to make it executable. Do this as the root user if you want it to run as root at boot-time.

Now, still as root, add the following entry into root’s crontab:

@reboot /usr/local/bin/mount_nfs.sh

Done. How easy was that? I tested this on my MacBook Air running Mac OSX 10.7.2 and it worked as expected running the script as root.

Private