NFS (Network File System) is the most efficient way to share files between macOS and Linux workstations. This guide walks you through creating NFS exports on macOS 10.5 or higher, enabling the NFS server, and testing the share from client machines.
Before You Begin
You will need:
- Administrator access on the Mac that will host the share
- The IP range of the network you want to allow (ask your network admin)
- A folder path you want to share (this guide uses
/Usersas an example) - The Terminal application from
/Applications/Utilities
Step 1: Open Terminal
- Open Finder
- Go to Applications > Utilities
- Double-click Terminal
You can also press Command + Space, type Terminal, and press Enter.
Step 2: Edit the Exports File
macOS reads NFS export definitions from /etc/exports. This file does not exist by default — creating or editing it requires root privileges.
- Run the following command:
sudo nano /etc/exports - Enter your administrator password when prompted
- Add a line defining the share. For example, to share
/Userswith the 192.168.0.0/16 subnet:/Users -network 192.168.0.0 -mask 255.255.0.0 - Press Control + O then Enter to save the file
- Press Control + X to exit nano
Export File Syntax
| Option | Purpose |
|---|---|
-network <subnet> | Restrict access to a network range |
-mask <netmask> | Subnet mask for the network option |
-ro | Export the directory read-only |
-maproot=nobody | Map remote root user to nobody (recommended) |
-alldirs | Allow clients to mount any subdirectory |
Change the IP and mask to match your network. For a typical home network, that might be -network 192.168.1.0 -mask 255.255.255.0.
Step 3: Enable the NFS Server
macOS ships with nfsd installed but disabled. Start it with:
sudo nfsd enable
Check the status to confirm it is running:
sudo nfsd status
You should see output similar to:
nfsd service is enabled
nfsd is running (pid XXXX, 8 threads)
If you later change /etc/exports, reload the export table without restarting the daemon:
sudo nfsd update
Step 4: Verify the Export
Run showmount to list the active exports:
showmount -e
Output should look similar to:
Exports list on localhost:
/Users Everyone
If the share does not appear, check /var/log/system.log for errors and re-verify the syntax in /etc/exports.
Step 5: Mount the Share From a Client
From a Linux Client
- Install the NFS client if needed (
sudo apt install nfs-commonon Debian/Ubuntu) - Create a mount point:
sudo mkdir /mnt/mac-users - Mount the share:
sudo mount -t nfs <mac-ip>:/Users /mnt/mac-users
From Another Mac
- Open Finder
- Press Shift + Command + G to open "Go to Folder"
- Enter:
/net/<hostname>/Users - The share mounts automatically via the
amdautomounter
You can also use Go > Connect to Server (Command + K) and enter nfs://<hostname>/Users.
Security Considerations
- Never export to
0.0.0.0on an untrusted or public network — NFS traffic is unencrypted by default - Use
-maproot=nobodyto prevent remote root users from gaining root access to exported directories - Prefer
-ro(read-only) exports when clients do not need to write - Restrict by subnet using
-network/-maskor list specific client IPs - Consider running NFS over a VPN or using Kerberos-authenticated NFS (sec=krb5p) for sensitive data
- macOS firewall rules apply — ensure TCP/UDP port 2049 and portmapper (port 111) are allowed from trusted hosts
Troubleshooting
showmount: can't do exports rpc: RPC: Program not registered
The NFS server is not running. Start it with sudo nfsd enable and verify with sudo nfsd status.
Client cannot mount the share
- Confirm the client IP falls within the
-network/-maskrange - Check for macOS firewall rules blocking port 2049
- Run
sudo nfsd checkexportsto validate/etc/exportssyntax
Permission denied on files after mount
This is usually a user ID (UID) mismatch. NFSv3 uses numeric UIDs from the server. Either align UIDs across machines or use -maproot / -mapall to remap ownership on the export.