After my issues marked here, I reinstalled the last version of Hugo that wasn’t giving me any issues (i.e. Hugo 52). I’ve also put this project in a temp repo you can find here:
Version:
Hugo Static Site Generator v0.52/extended darwin/amd64 BuildDate: unknown
Here is the error I’m getting when trying to run hugo server:
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at //localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
ERROR 2019/03/19 12:29:02 Error: listen tcp 127.0.0.1:1313: socket: too many open files
If you are using Linux/Unix you can probably increase limit using ulimit -n 4096 command. This command has a threshold and it can’t set whichever the number of opened files you want. So if you want to push it further then you need to modify /etc/security/limits.conf file and set hard and a soft limit.
Thanks, @ju52. I want to say this was an issue that came up before and @bep had created a solution for this already, but I can’t seem to find it on the forums. I’m on OSX Mojave and my current ulimit is “unlimited.” D’oh. But thanks anyways. Much appreciated!
Watching for changes in /Users/rwatters/Desktop/GitHub/lelahfinancial/{assets,content,data,layouts,static} WARN 2019/03/25 10:55:19 Unable to increase number of open files limit invalid argument
Ha, good old Google. I can’t believe I didn’t check there first. Figured this was something Hugo specific though since I haven’t had an issue with any other programs. I’ll give this a shot and mark solved if it works. Thanks for being a human search engine for me. Much appreciated!
@rdwatters I ran into a similar issue building/running an older hugo code branch of mine. I isolated the fix point to commit 708d4cee “Adjust rlimit logic” which is a macOS specific change that is part of the v0.55.0 release. I suspect this change became necessary either with a recent macOS or Go update (don’t have time to figure out which)
Applying that patch solved the problem for my old branch:
I have utilised this solution but its a temporary fix as this change effects my ability to use other pieces of software like Adobe Illustrator. Will there be a more permanent fix from hugo?
@vassudanagunta, @bep, @alexandros I’m using Hugo v.0.55.6 (extended), and that fix doesn’t seem to be working in my case. Kindly see attached screenshot.
I am also seeing this problem. I’m running Hugo v0.70.0/extended darwin/amd64 on macOS 10.15.4.
I’ve tried setting a larger ulimit and the .plist route recommended by the accepted answer above. However, neither of those are working for me. I’m still attempting to find the magic number here, but somewhere around 5000 seems to trigger the error.
There is no “magic” number and setting it at 500000 is perfectly ok. You will never go up this high in normal circumstances and will avoid “fine tuning” it. The only limit you might run into is the RAM of your computer. BUT - look at it this way: It’s only coming up when you compile your website.
And just in case this was not clear: It’s not hugo’s fault. It’s how file watchers on linux based systems work (Windows maybe, but I wouldn’t work on it just to find out).
Google for Increase “Open Files Limit” YOURSYSTEMNAME VERSION where yoursystemname is Ubuntu or Windows or whatever system you are under and version is the current version of your system. Posting a solution here would be moot, as the way changes over time.