Enabling and configuring NFS

Sunday, January 6th, 2013

This weekend, I had a need to get NFS working on my Mac. 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 ServerWestern 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:

man exports

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:

nfsd checkexports

And finally, if NFS is running, you can get a listing of all of your shares (‘mounts’ in NFS terminology) via this:

showmount -e

Hope this is useful to someone! If you’d prefer a GUI anyway, NFS Manager looks to be very well done.

Tested with: 10.7, 10.8, 10.9

2 comments on “Enabling and configuring NFS

  1. David says:

    That helped me out with my Mac + OpenELEC XBMC-problems.
    Tnx, /David

Leave a Reply