0

I want to set a new limit of possible open files with the command:

import resource

    resource.setrlimit(RLIMIT_NOFILE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))

However, I'm getting an error: ValueError: current limit exceeds maximum limit Is there any way to overcome this and set a new limit on OS X?

Ziva
  • 3,181
  • 15
  • 48
  • 80
  • Check this [answer](https://stackoverflow.com/a/62376139/544463) and this [gist](https://gist.github.com/tombigel/d503800a282fcadbee14b537735d202c) if they could help in your case in increase file limit system wide. – Yauhen Yakimovich Jun 14 '20 at 17:46

1 Answers1

1

You can only do it like this in Mac os.

import resource
target_procs = 10240
your_procs = ???
real_procs = min(target_procs, your_procs)
resource.setrlimit(RLIMIT_NOFILE, real_procs, resource.RLIM_INFINITY))

The reference is https://github.com/chapmanb/bcbio-nextgen/commit/0f590e12854df466053fcbfa590ab4ce9d7b9c45#diff-56930ee326340a3ab74bf8a0368e2d55

jia hilegass
  • 493
  • 2
  • 12