This is a MacOS thing and not a Hugo thing, so I won’t be able to help troubleshoot any further, but this is what I know.
The solution will only work for the shell that you are currently running on. If you want to make sure that these settings will stay throughout multiple shells, or just restarting your computer and having it still work, then you need to do the following:
-
in the
/etc/sysctl.conf
file, addkern.maxfilesperproc=65535 kern.maxfiles=100000
-
you may have to open this file with a sudo command and sign in if you are “not allowed” to edit it. sudo nano /etc/sysctl.conf
-
Next follow these directions to create or edit the
/Library/LaunchDaemons/limit.maxfiles.plist
and/Library/LaunchDaemons/limit.maxproc.plist
- MacOS Yosemite and macOS Sierra: How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12) · GitHub
- MacOS BigSur: How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12) · GitHub
- MacOS Monterey Increasing max processes and files to fix Apache (macOS Monterey) - MAMP Support Forums
-
Finally, restart to get these settings to update on your computer. You can check that the limits are correct by running
launchctl limit maxfiles
or
ulimit -n
Failing this, you can also try telling Hugo to use your hard disk drive instead of memory to run the server: hugo server -D --renderToDisk
Failing that, hugo server -D --watch=false
might work but you will lose the functionality of the page being able to reload to reflect changes you make - you’d have to restart the server to test out every edit.