I have a machine on which I do not want finder to run, so initially I made it unexecutable:
sudo chmod -R a-x /System/Library/CoreServices/Finder.app
But then realised that launchd was still trying to launch finder multiple times every second, resulting in colossal log files consisiting of millions of lines of:
com.apple.launchd.peruser.502[109] (com.apple.Finder[93799]) <Error>: posix_spawn("/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder", ...): Permission denied
com.apple.launchd.peruser.502[109] (com.apple.Finder[93799]) <Warning>: Exited with exit code: 1
So I edited /System/Library/LaunchAgents/com.apple.Finder.plist
so that it would not launch anymore. The problem I have now is forcing launchd to reload the plist, and therefore stop trying to launch finder. However, I cannot restart the machine.
I have tried using launchctl to both remove and unload the process but that doesn't appear to work:
$ sudo launchctl unload -w /System/Library/LaunchAgents/com.apple.Finder.plist
launchctl: Error unloading: com.apple.Finder
$ sudo launchctl remove com.apple.Finder
launchctl remove error: No such process
Is there anyway I can stop launchd continuously trying to load finder without restarting the machine?