Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fernandoaleman/160ffb14619a1405915c0813f2b61269 to your computer and use it in GitHub Desktop.
Save fernandoaleman/160ffb14619a1405915c0813f2b61269 to your computer and use it in GitHub Desktop.
/opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/chef-config-18.2.7/lib/chef-config/workstation_config_loader.rb:123:in `pwd': Too many open files - getcwd (Errno::EMFILE)

Problem

If you get the following error, the Mac ulimit is set too low.

/opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/chef-config-18.2.7/lib/chef-config/workstation_config_loader.rb:123:in `pwd': Too many open files - getcwd (Errno::EMFILE)
	from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/chef-config-18.2.7/lib/chef-config/workstation_config_loader.rb:123:in `locate_local_config'
	from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/chef-config-18.2.7/lib/chef-config/workstation_config_loader.rb:55:in `config_location'
	from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/chef-config-18.2.7/lib/chef-config/workstation_config_loader.rb:77:in `load'

Solution

Check ulimit

$ ulimit -n
256

Temporarily Change ulimit

$ ulimit -n 2048

Permanently Change ulimit

$ sudo launchctl limit maxfiles 2048 unlimited

Make sure to quit out of terminal and then open again for permanent changes to take effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment