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

1 Like


has anyone solved this issue ? With MacOS 10.15.3 and hugo v0.67.0/extended I have the same issue.

My site has 5200 markdown files. When I was around 3000 files, hugo was working fine.

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.

Thank you. I understand Hugo was not at fault.

Following these instructions and restarting my Mac did eventually work.

This topic was automatically closed after 20 hours. New replies are no longer allowed.