ERROR: Hugo 0.52, "too many open files"

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:


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
Press Ctrl+C to stop
ERROR 2019/03/19 12:29:02 Error: listen tcp 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.

credit: found it here


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!

Hmmm. Just realized I’m getting this:

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

Thoughts, @ju52?

When I check ulimit, I get the following already:

RPC-RWATTERS:~ rwatters$ ulimit
RPC-RWATTERS:~ rwatters$ 

there are some hard coded limits

try this

2 minuts to find with google :wink:


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:

git checkout v0.55.0 -- commands/limit_darwin.go

You can also do the following instead:

git cherry-pick 708d4cee
1 Like


I have edited the .plist files as per the gist. However, the second step where I’m supposed to set the session level doesn’t work.

When I run ulimit -n 200000, I get the following error -bash: ulimit: open files: cannot modify limit: Invalid argument

I’m on Mojave 10.14.5

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?

The permanent fix is Hugo v0.55. That’s what the cherry-pick grabs code from.

/cc @Weru

Oh right sorry, I totally misread that! Thanks.

@vassudanagunta, @bep, @onedrawingperday 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 suspect that’s the issue. Perhaps Hugo needs another tweak.

1 Like