Benches macOS

1

How to increase ulimit max open files, pe…

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

I have a shell script that needs to be able to receive hundreds of incoming socket connections. The default max of open files is 256. Strangely, if I run:

sudo ulimit -n 800

...ulimit -a still shows just 256 max open files. If I become root (sudo su), then I can increase the max files to 800, but that setting only remains while I'm root user.

Anyone know how to increase the max open files setting for my regular user name, as I run scripts from the Terminal bash shell?

...Rene

1 reply

Sign in or join Beachball Help to reply.

  1. 0

    Rene Fournier

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Wow, within 2 minutes, I realized what I had to do, so in case anyone else wonders the same, here's the solutions:

    Just edit the .bash_profile file in your home directory (create it if it's not already there), and add the line:

    ulimit -n 1024

    Now, whenever you start terminal, that process will be able to open up to 1024 files or socket connections.

    ...Rene