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.

About troyski

I'm a freelance UNIX engineer working in the UK. I'm married to Tina and between us we have six children. I'm a bit of an Apple fan boy, and all the Windows machines in the house are a thing of the past now.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Post navigation