HOWTO (Apple MacOSX)
NFS on Mac OS X
Once Mac OS X is up and running,
it pulls all its configuration information out of the Netinfo
Database. This is kind of neat and IMHO has a lot of good
potential. However, it is kind of a change for people with
a Unix background who like to edit configuration files by
Fortunately, you can still do so for many things using nidump(8)
and niload(8) . In any case, you can still do all your configuration
work from the command line using tools like niutil(1) or nicl(1)
Mac OS X has nice configuration tools for most settings that
users would like to modify. - What is dearly missing is a
tool to configure NFS exports on Mac OS X in a convenient
exportfs for Mac OS X
Have you ever wished that you could
do something like
exportfs -a /etc/exports
on your Mac OS X box and it would just "Do The Right
Well, now you can do exactly this using a litte script I've
hacked together after having spent too much time fiddling
with Netinfo DB entries by hand.
The script is based on the information compiled by J. T. Frey
is exportfs for Mac OS X or Darwin.
Here is what it can do for you:
exportfs v0.12, (C)
2002, Christian Czezatke Usage:
exportfs [-a ] [-c ] [-r ] [-l] [-s ] [-p] [-h]
Either one of the options listed above can be specified.
-a : exports everything from the listed exports file (-- :
read from stdin)
See exports(5) for more info
-c : processes an export entry specified at the command line.
exports(5) for valid export entries
-r : removes a given export entry (example: exportfs -r /Users)
-l : lists all currently exported filesystems (check with
whether NFS is happy)
-s : show all the properties for a given export
-p : Removes all export entries
-h : Shows this usage message
There are two things that I'm aware
of that are described in exports(5) , but do not work with
• You cannot specify more than one exported directory
in one line; i.e. the example:
/usr /usr/local -maproot=0:10
from the exports manpage will not work. It has to be re-written
/usr -maproot=0:10 friends
/usr -maproot=0:10 friends
• The -alldirs option is unsupported. - This is not
a real limitation in exportfs , but in the Mac OS X mountd
. Altough this option is described in exports(5) ,mountd does
not know how to handle it.
• Download exportfs . The current version is 0.12 (Nov.
• In the command line, get root priviliges using sudo
• Copy the script to a convenient location, for example
/usr/sbin using cp exportfs /usr/sbin
• Make the script executable: chmod u+x /usr/sbin/exportfs
(Of course all this must be done
with root privilges using sudo -s .)
On my box, I have a very simple /etc/exports that looks like
/Volumes/Data -maproot=nobody -ro holmes
This will allow each box in my LAN (192.168.2.XXX) to mount
the /Users directory from the Mac. Furthermore, /Volumes/Data
is exported read-only for a box named holmes .
After having created this /etc/exports
file, you need to run exportfs in order to create the necessary
entries in the Netinfo DB:
./exportfs -a /etc/exports
After that, you can use showmount in order to verify that
mountd is happy with your export entries ( exportfs will automatically
send a HUP signal to your mountd , so that it will recognize
the configuration changes):
Exports list on localhost:
If you want to remove an export entry (let's say the /Volumes/Data
entry, for example, just do a:
#exportfs -r /Volumes/Data
You can use exportfs
-l at any time, to see which
export entries are currently registered in the Netinfo DB.
You can also use exportfs to create export entries on the
fly: This is convenient if you want to give anoter computer
in your LAN access to a CD (or even a disk image), for example.
Let's say I've just inserted a CD-ROM in the drive on my Mac
and I want to give the box notebook access to this CD-ROM.
First, I have to figure out where OS X mounted the CD: Just
use /sbin/mount to figure this out:
/dev/disk2s1s2 on /Volumes/MY_CD_NAME
You can then do a
#exportfs -c /Volumes/MY_CD_NAME
In order to remove the export entry for the CD when you're
done with it, just do a
#exportfs -r /Volumes/MY_CD_NAME
If you are having problems getting
this to work
• Verify that you have actually created the Netinfo
DB entries using exportfs -l
• Check /var/log/system.log for error messages from
mountd . If mountd complains about errors, use exportfs -s
on the entry that mountd was complaning about.
• Make sure that portmap ,mountd and nfsd are running.
- If you don't know enough Unix stuff to know how to do this,
just reboot Mac OS X and it will automatically start these
services for you once you have created the export entries
in the Netinfo DB with exportfs .