# "Too many open files" error on Mac OSX

**URL:** <https://discuss.elastic.co/t/too-many-open-files-error-on-mac-osx/11940>\
**Category:** Elasticsearch\
**Created:** [May 13, 2013, 7:42pm UTC](https://discuss.elastic.co/t/too-many-open-files-error-on-mac-osx/11940 "2013-05-13T19:42:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Wyatt](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@Allen\_Wyatt](https://discuss.elastic.co/u/Allen_Wyatt)\
**Post date:** [May 13, 2013, 7:42pm UTC](https://discuss.elastic.co/t/too-many-open-files-error-on-mac-osx/11940/1 "2013-05-13T19:42:20Z")

</div>

Elasticsearch is giving me "Too many open files" errors on my macbook  
running OSX 10.8.3 and I can not figure out how to configure Elasticsearch  
to use more files.

I've found several web pages showing how to increase the open files limit  
on OSX and followed those directions, but Elasticsearch doesn't see the  
increased limit.

I used sysctl (edited /etc/sysctl.conf) to increase the file limits.

I used launchctl (edited /etc/launchd.conf) to increase the file limits.

When I run the "ulimit -a" command it says "open files (-n) 400000".

When I run the "kern.maxfilesperproc" command it says  
"kern.maxfilesperproc: 400000".

When I run the "kern.maxfiles" command it says "kern.maxfiles: 400000".

I run the "ulimit -S -n 120000" command in the bash script I use to start  
Elasticsearch.

Whatever I do, Elasticsearch always reports (using  
-Des.max-open-files=true): "max\_open\_files [10215]"

Suggestions?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![mattweber](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattweber/32/44940_2.png) [@mattweber](https://discuss.elastic.co/u/mattweber)\
**Post date:** [May 13, 2013, 8:58pm UTC](https://discuss.elastic.co/t/too-many-open-files-error-on-mac-osx/11940/2 "2013-05-13T20:58:55Z")

</div>

In /etc/launchd.conf put:

limit maxfiles 400000 400000

Make sure in your ~/.bashrc file you are not setting the ulimit with  
something like "ulimit -n 1024".  
Open a new terminal, and run:

launchctl limit maxfiles  
ulimit -a

You should see the maxfiles set to 400000 for both of those.

Hope this helps.

Thanks,  
Matt Weber

On Mon, May 13, 2013 at 12:42 PM, Allen Wyatt [allen.wyatt.tvly@gmail.com](mailto:allen.wyatt.tvly@gmail.com)wrote:

> Elasticsearch is giving me "Too many open files" errors on my macbook  
> running OSX 10.8.3 and I can not figure out how to configure Elasticsearch  
> to use more files.
> 
> I've found several web pages showing how to increase the open files limit  
> on OSX and followed those directions, but Elasticsearch doesn't see the  
> increased limit.
> 
> I used sysctl (edited /etc/sysctl.conf) to increase the file limits.
> 
> I used launchctl (edited /etc/launchd.conf) to increase the file limits.
> 
> When I run the "ulimit -a" command it says "open files (-n) 400000".
> 
> When I run the "kern.maxfilesperproc" command it says  
> "kern.maxfilesperproc: 400000".
> 
> When I run the "kern.maxfiles" command it says "kern.maxfiles: 400000".
> 
> I run the "ulimit -S -n 120000" command in the bash script I use to start  
> Elasticsearch.
> 
> Whatever I do, Elasticsearch always reports (using  
> -Des.max-open-files=true): "max\_open\_files [10215]"
> 
> Suggestions?
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![andydude](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andydude/32/1431_2.png) [@andydude](https://discuss.elastic.co/u/andydude)\
**Post date:** [June 30, 2014, 3:54pm UTC](https://discuss.elastic.co/t/too-many-open-files-error-on-mac-osx/11940/3 "2014-06-30T15:54:33Z")

</div>

I'm trying to use elasticsearch on maxosx as well. I've tried everything as well. I've performed all of the above steps, and I'm still getting a number (10209) that has absolutely nothing to do with the number I've entered (65536). Is it possible that the JNA code which determines the maximum number of open files in elasticsearch is broken on macosx?

$ ulimit -Sn  
65536

$ launchctl limit maxfiles  
maxfiles 65536 65536

$ bin/elasticsearch -f -Des.max-open-files=true  
[2014-06-30 11:44:42,797][INFO][bootstrap] max\_open\_files [10209]  
...  
^C

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:18am UTC](https://discuss.elastic.co/t/too-many-open-files-error-on-mac-osx/11940/4 "2017-07-06T01:18:54Z")

</div>


