I decided to run the server as an XCP service, because it’s a nice easy way to make little sub-processes in macOS. All of that actually worked quite nicely, except for one fundamental part of the application: Apple Events, which have to be called on the main thread. Unfortunately in an XPC service the main thread is blocked by the service listener, meaning the Apple Events can’t run.