MacOS – Why won’t kern.maxfiles setting in /etc/sysctl.conf stick on macOs 10.15

finderkernelmacos

i was getting some strange errors and crashes on some apps including the finder.
I figured out it happens due to the
kern.maxfiles
kern.maxfilesperproc
settings

i was following the advice from here
Why won't kern.maxfiles setting in /etc/sysctl.conf stick?

i created the /etc/sysctl.conf and added those lines

kern.maxfiles=20480
kern.maxfilesperproc=18000

but after restarting the same default settings of 10240 are applied.
I also made sure that trailing spaces are removed.

As this article is quite old i was thinking if something might have changed in macOs.
Can anyone help me getting this sorted?

Best Answer

I found the solution. Actually sysctl.conf file works when starting the computer in safe-mode. So i removed the sysctl.conf and then removed all launchDaemons and started the computer normally. Suddenly the defaults for kern.maxfiles and kern.maxfilesperproc where around 200000/100000. I copied one after the other launchDaemon back and restarted. It turned out that two .plists caused the values to go down to 10240, wich are related to Anydesk:

com.philandro.anydesk.Helper.plist
com.philandro.anydesk.service.plist

I contacted the developers of Anydesk about my findings and hope they will optimize their software.