Go Build Error - Too Many Open Files

I received the following go build error on my Mac. However, the same code ran fine on a linux server.

ERROR build.go:386: Failed to parse build errors error=“go tool compile: fork/exec /usr/local/go/pkg/tool/darwin_amd64/compile: too many open files\n”
ERROR harness.go:219: Build detected an error error=“Go Compilation Error: See console for build error.”

The problem was the mac os open files limit was set too low at 256. To solve the problem I modified the .bashrc file to increase the amount of open files allowed to over a million. I added the following line to the .bashrc file:

launchctl limit maxfiles 1048576 1048576

Our Products

Keyword level attribution for Apple Search Ads. Optimize your bids and increase your revenue. Sign up for free at

White Noise and Deep Sleep Sounds
Calming and relaxing sounds that will help you sleep like a baby tonight.
Download for free from the App Store.
Get it on Google Play.

Our Sponsors

Get Sleepy
Get Sleepy
The free podcast that puts you to sleep with meditative bedtime stories. Listen at