This weekend, I had a need to get NFS working on my Mac running 10.8.2 – though these instructions should work for any OS 10.7 and above. My reasoning? I have a WDTV Live, and found that streaming video through NFS adds less overhead than using (the excellent and free) PS3 Media Server. Western Digital’s instructions are GUI-heavy and somewhat incomplete, though, so I decided to write my own.
To configure NFS, you’ll need to create a file in /etc/exports:
sudo nano /etc/exports
If the file doesn’t already exist, it should be empty. This file contains your list of shares. Here’s an example of a share from my machine:
/Users/mike/Downloads -ro -network 192.168.1.0 -mask 255.255.255.0
Breaking it down – first, you’ve got the path to the folder you want to share. Next, it’s set so that anyone connecting has read-only access. And finally, the two last sections detail the IP range that’s allowed to access shares on your NFS server. There are many more options you can add – see this for a full listing:
Add one share per line. Once you’re happy with your exports file, all you need to do is enable NFS:
sudo nfsd enable
This will start the NFS service and keep it running, even after a reboot. You can also start and stop it on an as-needed basis:
sudo nfsd start
sudo nfsd stop
If you make changes to your exports file, you might need to restart the NFS daemon for your changes to take effect:
sudo nfsd restart
If you’d like to verify that your exports file is properly formatted, this will be useful:
And finally, if NFS is running, you can get a listing of all of your shares (‘mounts’ in NFS terminology) via this:
Hope this is useful to someone! If you’d prefer a GUI anyway, NFS Manager looks to be very well done.
Update: Allister (@Sacrilicious) suggests using the
command to create the mounts, rather than editing the /etc/exports file directly.