I'm on Mac Monterey 12.1 and increased my shared memory limits in /etc/sysctl.conf file:

kern.sysv.shmmax: 16777216
kern.sysv.shmmin: 1
kern.sysv.shmmni: 128
kern.sysv.shmseg: 512
kern.sysv.shmall: 4096
security.mac.posixshm_enforce: 1
security.mac.sysvshm_enforce: 1

and restarted (and shut down) the machine. However, after restarting when i run sysctl -A | grep shm it shows values different to the file:

kern.sysv.shmall: 1024
kern.sysv.shmmax: 4194304
kern.sysv.shmmin: 1
kern.sysv.shmmni: 32
kern.sysv.shmseg: 8
security.mac.posixshm_enforce: 1
security.mac.sysvshm_enforce: 1

even though /etc/sysctl.conf still shows the changes as persisted.

In other words, I have no idea where sysctl -A | grep shm is getting these values from.

Does anyone know where I need to modify them?

2 Answers 2

  1. Download file .plist https://anonfiles.com/3eGaR6kfya/com.startup.sysctl_plist
  2. Move the downloaded file to /Library/LaunchDaemons/com.startup.sysctl.plist
  3. Launch the terminal and write two commands in turn: first "sudo chown root:wheel /Library/LaunchDaemons/com.startup.sysctl.plist" and then "sudo launchctl load -w /Library/LaunchDaemons/com.startup.sysctl.plist"
  4. Reboot the system.
  • Why reboot? This is not windows...
    – Nils
    Jun 9, 2022 at 21:56

Kudos to alexander-dankin for setting me on the right path.

Per OP, I had a similar issue with fio benchmarking and solved it with a modified version of what Alexander posted.

Below are the steps that are somewhat abridged and tailored to user997112's question.


  • Disable SIP
    • Disclaimer from Apple


      Disable SIP only temporarily to perform necessary tasks, and reenable it as soon as possible. Failure to reenable SIP when you are done testing leaves your computer vulnerable to malicious code.

  • Create /Library/LaunchDaemons/com.startup.sysctl.plist
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <!-- DISABLE SIP TO USE: macOS Recovery > Utilities > Terminal > `csrutil disable` > Reboot -->
    <plist version="1.0">
  • Load the PLIST after a few housekeeping items
    # sanity check
    sysctl -a | grep shm
    # set permissions
    sudo chown root:wheel /Library/LaunchDaemons/com.startup.sysctl.plist
    # validate key-value pairs
    plutil /Library/LaunchDaemons/com.startup.sysctl.plist
    # load plist
    sudo launchctl bootstrap system /Library/LaunchDaemons/com.startup.sysctl.plist
    # check logs
    tail -f /tmp/sysctl.out
    tail -f /tmp/sysctl.err
    # recheck sysctl values
    sysctl -a | grep shm


macos - Values from sysctl -A don't match /etc/sysctl.conf even after restart - Unix & Linux Stack Exchange

Setting shared memory in Catalina | Apple Developer Forums

c++ - Shared memory "Too many open files" but ipcs doesn't show many allocations - Stack Overflow

kernel - How do I increase the max open files in macOS Big Sur? - Super User

A launchd Tutorial

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .