I ran across this error while trying to surf around the internet on my Mac today in Google Chrome. The Chrome error message was RESULT_CODE_INVALID_CMDLINE_URL. I also noticed that my Time Machine backups were failing. This lead me on a chase to figure out why this was happening, seemingly random.
I opened the Console app on my Mac and observed many messages from apps stating “Too many open files.” I also noticed that this only seemed to happen while the system is trying to run a Time Machine backup. Any other time it seems to be fine.
My iMac is a file server and Plex media server for my entire home network. So with all of the running processes on the system, it makes sense that I am hitting some kind of limit. Turns out that there is a limit set on how many files can be open at any given time by the system, and to solve this issue, we need to increase these limits.
I stumbled across this SuperUser post on StackExchange. This is exactly what I was experiencing!
To fix this, we need to launch a terminal window and run a few commands:
sudo sysctl -w kern.maxfiles=20480 sudo sysctl -w kern.maxfilesperproc=18000
Then, to make the change permanent, we need to create a new file. Run the following command:
sudo nano /etc/sysctl.conf
Enter the following lines into the file:
kern.maxfiles=20480 kern.maxfilesperproc=18000
Press Ctrl+X and Y to save the file.
Now, your system should be functioning normally again!