Difference between ulimit, launchctl, sysctl?

Solution 1:

1. ulimit

This is a builtin command of your shell (bash/ash/zsh etc). It temporarily sets process limits for the current shell. This is not macOS specific by the way.

2. sysctl

Most unix-like (Linux/*BSD/macOS) systems set global limit/kernel settings via the sysctl command /etc/sysctl.conf config file.

Seems like macOS does not honor sysctl.conf on startup anymore. So on macOS, it looks like sysctl is merely usable for temporarily setting the global limits.

3. launchd / launchctl

For setting global limits in a persistent way, use launchctl on macOS.