# Modifying the /etc/exports file on mac

**URL:** <https://forum.logik.tv/t/modifying-the-etc-exports-file-on-mac/11877>\
**Category:** Sysadmins\
**Tags:** command-line\
**Created:** [December 13, 2024, 12:15pm UTC](https://forum.logik.tv/t/modifying-the-etc-exports-file-on-mac/11877 "2024-12-13T12:15:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnag](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/johnag/32/573_2.png) [@johnag](https://forum.logik.tv/u/johnag)\
**Post date:** [December 13, 2024, 12:15pm UTC](https://forum.logik.tv/t/modifying-the-etc-exports-file-on-mac/11877/1 "2024-12-13T12:15:31Z")

</div>

Hi.  
I’m trying to modify my flame system, /etc/exports file with nano. when I go to write out the changes it says operation not permitted. I have enabled root access and in the terminal I started off by going via su and my root password. why can’t I update my file?

---

<div class="post-metadata">

**Author:** ![kily](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@kily](https://forum.logik.tv/u/kily)\
**Post date:** [December 13, 2024, 1:15pm UTC](https://forum.logik.tv/t/modifying-the-etc-exports-file-on-mac/11877/2 "2024-12-13T13:15:01Z")

</div>

Write “sudo nano /etc/exports” and enter your **user password** , assuming that your user has administrative privileges.

You don’t have to use root user. sudo is for administrative user and it is the most convenient.

---

<div class="post-metadata">

**Author:** ![johnag](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/johnag/32/573_2.png) [@johnag](https://forum.logik.tv/u/johnag)\
**Post date:** [December 13, 2024, 1:36pm UTC](https://forum.logik.tv/t/modifying-the-etc-exports-file-on-mac/11877/3 "2024-12-13T13:36:59Z")

</div>

That’s what I did at first but I still get the error message saying operation not Permitted

When I do, I get info on the file. It has a lock icon on it. I tried to unlock it but I get an error message not permitted. I am an admin user so I don’t know why I can’t Unlock it

---

<div class="post-metadata">

**Author:** ![philm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/philm/32/9286_2.png) [@philm](https://forum.logik.tv/u/philm)\
**Post date:** [December 13, 2024, 2:05pm UTC](https://forum.logik.tv/t/modifying-the-etc-exports-file-on-mac/11877/4 "2024-12-13T14:05:49Z")

</div>

[Bresink.com](https://www.bresink.com/osx/143439/Docs-en/pgs/0200-Share.html)

And while you’re there you could try Marcel s software called [NFSManager](http://www.bresink.com/osx/NFSManager.html)

And yes, [It should be easy](https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/Enabling-network-NFS-shares-in-Mac-OS-X.html)

Lastly, if you’re on a Mac you may want use pico, instead of nano.

---

<div class="post-metadata">

**Author:** ![kily](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@kily](https://forum.logik.tv/u/kily)\
**Post date:** [December 13, 2024, 2:18pm UTC](https://forum.logik.tv/t/modifying-the-etc-exports-file-on-mac/11877/5 "2024-12-13T14:18:34Z")

</div>

I’m on rocky linux. My /etc/exports file has root as owner, but I can edit it with sudo. I have just checked it.

Maybe is it in use?

---

<div class="post-metadata">

**Author:** ![randy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/randy/32/6122_2.png) [@randy](https://forum.logik.tv/u/randy)\
**Post date:** [December 13, 2024, 2:47pm UTC](https://forum.logik.tv/t/modifying-the-etc-exports-file-on-mac/11877/6 "2024-12-13T14:47:09Z")

</div>

Why You Can’t Modify /etc/exports on macOS

On macOS, modifying system configuration files like /etc/exports requires elevated permissions because these files are protected by the operating system. Here’s why you might be encountering issues:  
1. File Permissions: The /etc/exports file is owned by root and is writable only by root. Attempting to modify it without sudo results in a “permission denied” error.  
2. System Integrity Protection (SIP): macOS includes a feature called System Integrity Protection (SIP), which restricts modifications to certain system files even by the root user. If SIP is protecting /etc/exports, you need to temporarily disable SIP to modify it.

Steps to Modify /etc/exports

1. Use sudo to Edit the File

To modify the file with elevated permissions:

sudo nano /etc/exports

After making your changes, save and exit (in nano, use Ctrl+O, then Ctrl+X).

1. Temporarily Disable SIP (if Necessary)

If you still encounter issues after using sudo, SIP might be blocking access. To disable SIP temporarily:  
1. Boot into Recovery Mode:  
• Restart your Mac.  
• Hold Command (⌘) + R during boot to enter Recovery Mode.  
2. Open Terminal in Recovery Mode:  
• From the menu, navigate to Utilities \> Terminal.  
3. Disable SIP:  
• Run the following command:

csrutil disable

```
•	Restart your Mac.

4.	Modify /etc/exports:
•	Edit the file as described in Step 1.
5.	Re-enable SIP (Important for Security):
•	Reboot into Recovery Mode and run:

```

csrutil enable

```
•	Restart your Mac again.

```

1. Restart the NFS Service

After modifying /etc/exports, restart the NFS service to apply the changes:

sudo nfsd restart

To check the status of the NFS server:

sudo nfsd checkexports

Common Issues  
1. File Doesn’t Exist: On some macOS installations, /etc/exports may not exist by default. You can create it using:

sudo touch /etc/exports

```
2.	Permission Errors Persist: Ensure you are using an admin account. Non-admin users cannot execute sudo.
3.	Configuration Errors: Use the correct syntax for NFS exports in /etc/exports. For example:

```

/path/to/share 192.168.1.0/24(rw,async,no\_subtree\_check)

---

<div class="post-metadata">

**Author:** ![johnag](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/johnag/32/573_2.png) [@johnag](https://forum.logik.tv/u/johnag)\
**Post date:** [December 14, 2024, 5:03am UTC](https://forum.logik.tv/t/modifying-the-etc-exports-file-on-mac/11877/7 "2024-12-14T05:03:16Z")

</div>

Hi

@randy thanks for the info.

Yes the problem has something to do with the SIP. @Slabrie suggested the following which worked.

as a root user:  
chflags nosimmutable /etc/exports  
nano /etc/exports  
chflags simmutable /etc/exports  
nfsd update

---

<div class="post-metadata">

**Author:** ![Slabrie](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Slabrie](https://forum.logik.tv/u/Slabrie)\
**Post date:** [December 16, 2024, 12:15pm UTC](https://forum.logik.tv/t/modifying-the-etc-exports-file-on-mac/11877/8 "2024-12-16T12:15:37Z")

</div>

We all love macOS security, don’t we? 😉
