# rtcontrib - setting maximum number of open	files on OSX 10.6.8

**URL:** <https://discourse.radiance-online.org/t/rtcontrib-setting-maximum-number-of-open-files-on-osx-10-6-8/4169>\
**Category:** radiance-general\
**Created:** [July 20, 2011, 7:31pm UTC](https://discourse.radiance-online.org/t/rtcontrib-setting-maximum-number-of-open-files-on-osx-10-6-8/4169 "2011-07-20T19:31:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_McNeil2](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/a/958977/32.png) [@Andrew\_McNeil2](https://discourse.radiance-online.org/u/Andrew_McNeil2)\
**Post date:** [July 20, 2011, 7:31pm UTC](https://discourse.radiance-online.org/t/rtcontrib-setting-maximum-number-of-open-files-on-osx-10-6-8/4169/1 "2011-07-20T19:31:06Z")

</div>

Hi Michael,  
I don't really know anything about launchd.conf, but I can explain why 'sudo ulimit -n 4096' doesn't work. ulimit applies to the shell instance in which it is called. When you use sudo you are essentially creating a shell with root permissions to execute the command. When the command is finished the shell is terminated. You are effectively changing the properties for a temporary shell, not the one you are trying to use.

Does your user account have admin priveliges? You can give admin privileges in the system preferences. If you have admin privileges than you should be able to use ulimit.

Andy

> **···**
>
> On Jul 20, 2011, at 12:01 PM, Michael Martinez wrote:
> 
> > My second question is for Radiance users running OSX. I'm having trouble setting the maximum number of open files to more than 1024. I'm running OSX 10.6.8, and there seems to be two ways to change the maximum number of open files - one using ulimit and one using launchctl.
> > 
> > In .bash\_profile I have this line:
> > 
> > ulimit -S -n 4096
> > 
> > In etc/launchchd.conf I have this:
> > 
> > limit maxfiles 4096  
> > sysctl -w kern.maxfiles=4096
> > 
> > and in etc/sysctl.conf I have:
> > 
> > kern.maxfiles=4096 kern.maxfilesperproc=4096
> > 
> > In a terminal line, when I enter launchctl limit I see this:
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cpu unlimited unlimited  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;filesize unlimited unlimited  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data unlimited unlimited  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stack 8388608 67104768  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;core 0 unlimited  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rss unlimited unlimited  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;memlock unlimited unlimited  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxproc 266 532  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxfiles 4096 4096
> > 
> > Which is good. 4096 is more than the 2306 files I want rtcontrib to talk to at the same time.
> > 
> > But then, looking at ulimit -a in a terminal, I see this:
> > 
> > core file size (blocks, -c) 0  
> > data seg size (kbytes, -d) unlimited  
> > file size (blocks, -f) unlimited  
> > max locked memory (kbytes, -l) unlimited  
> > max memory size (kbytes, -m) unlimited  
> > open files (-n) 1024  
> > pipe size (512 bytes, -p) 1  
> > stack size (kbytes, -s) 8192  
> > cpu time (seconds, -t) unlimited  
> > max user processes (-u) 266  
> > virtual memory (kbytes, -v) unlimited
> > 
> > Which is bad - 1024 is less than the 2306 files I want rtcontrib to talk to at the same time. Its also surprising given that it should be set to 4096 by .bash\_profile.
> > 
> > Then when I try ulimit -n 4096, I get this:
> > 
> > bash: ulimit: open files: cannot modify limit: Operation not permitted
> > 
> > If I use sudo, it takes the command, but when I look at ulimit -a again, the open files limit still says 1024, and despite what launchctl limit says, 1024 is the governing number of maximum open files.
> > 
> > Has anyone out there had success setting this in OSX 10.6 or higher? Or has anyone updated to 10.7 (just released today) and had success?
> > 
> > Many thanks,  
> > Michael
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > Radiance-general mailing list  
> > Radiance-general@radiance-online.org  
> > [http://www.radiance-online.org/mailman/listinfo/radiance-general](http://www.radiance-online.org/mailman/listinfo/radiance-general)

---

<div class="post-metadata">

**Author:** ![Michael\_Martinez](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/m/df705f/32.png) [@Michael\_Martinez](https://discourse.radiance-online.org/u/Michael_Martinez)\
**Post date:** [July 20, 2011, 8:14pm UTC](https://discourse.radiance-online.org/t/rtcontrib-setting-maximum-number-of-open-files-on-osx-10-6-8/4169/2 "2011-07-20T20:14:56Z")

</div>

Thanks a bunch for the replies so far.

Jack - OSX doesn't seem to have a limits.conf configuration file...

David - switching the .bash\_profile line in my home folder from "ulimit -S -n 4096" to "ulimit -n 4096" didn't make the change..

Andy - thanks for the sudo explanation - that makes sense as to why it's not making the change. I do have admin privileges, but for some reason I still can't get ulimit to change the limit over 1024.

Oddly enough, I can get ulimit to lower the maximum number of open files, something like ulimit -n 512 works fine and changes the setting. What I can't do is then increase back to 1024 - I get the 'operation not permitted' message. When I restart my machine, the limit returns to 1024. I can use ulimit and lower it to 1023, but even when I try ulimit -n 1025, I still get the message:  
bash: ulimit: open files: cannot modify limit: Operation not permitted

> **···**
>
> On Jul 20, 2011, at 12:31 PM, Andy McNeil wrote:
> 
> > Hi Michael,  
> > I don't really know anything about launchd.conf, but I can explain why 'sudo ulimit -n 4096' doesn't work. ulimit applies to the shell instance in which it is called. When you use sudo you are essentially creating a shell with root permissions to execute the command. When the command is finished the shell is terminated. You are effectively changing the properties for a temporary shell, not the one you are trying to use.
> > 
> > Does your user account have admin priveliges? You can give admin privileges in the system preferences. If you have admin privileges than you should be able to use ulimit.
> > 
> > Andy
> > 
> > On Jul 20, 2011, at 12:01 PM, Michael Martinez wrote:
> > 
> > > My second question is for Radiance users running OSX. I'm having trouble setting the maximum number of open files to more than 1024. I'm running OSX 10.6.8, and there seems to be two ways to change the maximum number of open files - one using ulimit and one using launchctl.
> > > 
> > > In .bash\_profile I have this line:
> > > 
> > > ulimit -S -n 4096
> > > 
> > > In etc/launchchd.conf I have this:
> > > 
> > > limit maxfiles 4096  
> > > sysctl -w kern.maxfiles=4096
> > > 
> > > and in etc/sysctl.conf I have:
> > > 
> > > kern.maxfiles=4096 kern.maxfilesperproc=4096
> > > 
> > > In a terminal line, when I enter launchctl limit I see this:
> > > 
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cpu unlimited unlimited  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;filesize unlimited unlimited  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data unlimited unlimited  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stack 8388608 67104768  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;core 0 unlimited  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rss unlimited unlimited  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;memlock unlimited unlimited  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxproc 266 532  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxfiles 4096 4096
> > > 
> > > Which is good. 4096 is more than the 2306 files I want rtcontrib to talk to at the same time.
> > > 
> > > But then, looking at ulimit -a in a terminal, I see this:
> > > 
> > > core file size (blocks, -c) 0  
> > > data seg size (kbytes, -d) unlimited  
> > > file size (blocks, -f) unlimited  
> > > max locked memory (kbytes, -l) unlimited  
> > > max memory size (kbytes, -m) unlimited  
> > > open files (-n) 1024  
> > > pipe size (512 bytes, -p) 1  
> > > stack size (kbytes, -s) 8192  
> > > cpu time (seconds, -t) unlimited  
> > > max user processes (-u) 266  
> > > virtual memory (kbytes, -v) unlimited
> > > 
> > > Which is bad - 1024 is less than the 2306 files I want rtcontrib to talk to at the same time. Its also surprising given that it should be set to 4096 by .bash\_profile.
> > > 
> > > Then when I try ulimit -n 4096, I get this:
> > > 
> > > bash: ulimit: open files: cannot modify limit: Operation not permitted
> > > 
> > > If I use sudo, it takes the command, but when I look at ulimit -a again, the open files limit still says 1024, and despite what launchctl limit says, 1024 is the governing number of maximum open files.
> > > 
> > > Has anyone out there had success setting this in OSX 10.6 or higher? Or has anyone updated to 10.7 (just released today) and had success?
> > > 
> > > Many thanks,  
> > > Michael
> > > 
> > > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > > Radiance-general mailing list  
> > > Radiance-general@radiance-online.org  
> > > [http://www.radiance-online.org/mailman/listinfo/radiance-general](http://www.radiance-online.org/mailman/listinfo/radiance-general)
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > Radiance-general mailing list  
> > Radiance-general@radiance-online.org  
> > [http://www.radiance-online.org/mailman/listinfo/radiance-general](http://www.radiance-online.org/mailman/listinfo/radiance-general)

---

<div class="post-metadata">

**Author:** ![Michael\_Martinez](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/m/df705f/32.png) [@Michael\_Martinez](https://discourse.radiance-online.org/u/Michael_Martinez)\
**Post date:** [July 20, 2011, 8:50pm UTC](https://discourse.radiance-online.org/t/rtcontrib-setting-maximum-number-of-open-files-on-osx-10-6-8/4169/3 "2011-07-20T20:50:36Z")

</div>

blarg!

It's always in the last place you look... and after you email the radiance list.

I needed to add ulimit -n 4096 to .bashrc in my home directory as well...

> **···**
>
> On Jul 20, 2011, at 12:31 PM, Andy McNeil wrote:
> 
> > Hi Michael,  
> > I don't really know anything about launchd.conf, but I can explain why 'sudo ulimit -n 4096' doesn't work. ulimit applies to the shell instance in which it is called. When you use sudo you are essentially creating a shell with root permissions to execute the command. When the command is finished the shell is terminated. You are effectively changing the properties for a temporary shell, not the one you are trying to use.
> > 
> > Does your user account have admin priveliges? You can give admin privileges in the system preferences. If you have admin privileges than you should be able to use ulimit.
> > 
> > Andy
> > 
> > On Jul 20, 2011, at 12:01 PM, Michael Martinez wrote:
> > 
> > > My second question is for Radiance users running OSX. I'm having trouble setting the maximum number of open files to more than 1024. I'm running OSX 10.6.8, and there seems to be two ways to change the maximum number of open files - one using ulimit and one using launchctl.
> > > 
> > > In .bash\_profile I have this line:
> > > 
> > > ulimit -S -n 4096
> > > 
> > > In etc/launchchd.conf I have this:
> > > 
> > > limit maxfiles 4096  
> > > sysctl -w kern.maxfiles=4096
> > > 
> > > and in etc/sysctl.conf I have:
> > > 
> > > kern.maxfiles=4096 kern.maxfilesperproc=4096
> > > 
> > > In a terminal line, when I enter launchctl limit I see this:
> > > 
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cpu unlimited unlimited  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;filesize unlimited unlimited  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data unlimited unlimited  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stack 8388608 67104768  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;core 0 unlimited  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rss unlimited unlimited  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;memlock unlimited unlimited  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxproc 266 532  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxfiles 4096 4096
> > > 
> > > Which is good. 4096 is more than the 2306 files I want rtcontrib to talk to at the same time.
> > > 
> > > But then, looking at ulimit -a in a terminal, I see this:
> > > 
> > > core file size (blocks, -c) 0  
> > > data seg size (kbytes, -d) unlimited  
> > > file size (blocks, -f) unlimited  
> > > max locked memory (kbytes, -l) unlimited  
> > > max memory size (kbytes, -m) unlimited  
> > > open files (-n) 1024  
> > > pipe size (512 bytes, -p) 1  
> > > stack size (kbytes, -s) 8192  
> > > cpu time (seconds, -t) unlimited  
> > > max user processes (-u) 266  
> > > virtual memory (kbytes, -v) unlimited
> > > 
> > > Which is bad - 1024 is less than the 2306 files I want rtcontrib to talk to at the same time. Its also surprising given that it should be set to 4096 by .bash\_profile.
> > > 
> > > Then when I try ulimit -n 4096, I get this:
> > > 
> > > bash: ulimit: open files: cannot modify limit: Operation not permitted
> > > 
> > > If I use sudo, it takes the command, but when I look at ulimit -a again, the open files limit still says 1024, and despite what launchctl limit says, 1024 is the governing number of maximum open files.
> > > 
> > > Has anyone out there had success setting this in OSX 10.6 or higher? Or has anyone updated to 10.7 (just released today) and had success?
> > > 
> > > Many thanks,  
> > > Michael
> > > 
> > > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > > Radiance-general mailing list  
> > > Radiance-general@radiance-online.org  
> > > [http://www.radiance-online.org/mailman/listinfo/radiance-general](http://www.radiance-online.org/mailman/listinfo/radiance-general)
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > Radiance-general mailing list  
> > Radiance-general@radiance-online.org  
> > [http://www.radiance-online.org/mailman/listinfo/radiance-general](http://www.radiance-online.org/mailman/listinfo/radiance-general)
