Triggering Launch Agents for path in sandboxed app using WatchPaths does not work I am trying to create a user LaunchAgents that will trigger a script when a path managed by a sandbox app will change (in my case, when /Library/Containers/com.omnigroup.OmniFocus3/Data/Library/Application\ Support/OmniFocus/OmniFocus.ofocus will change).

For this, I want to use the WatchPaths key of launchd, I already tried with a Folder Action, but those are limited to file addition in a folder.

I have made a working test to listen on a file and folder in my home directory and trigger a notification. e.g.:

&lt;?xml version=“1.0” encoding=“UTF-8”?&gt;
&lt;!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”&gt;
&lt;plist version=“1.0”&gt;
&lt;dict&gt;
        &lt;key&gt;Label&lt;/key&gt;
        &lt;string&gt;me.mayeu.helloworld&lt;/string&gt;
        &lt;key&gt;ProgramArguments&lt;/key&gt;
        &lt;array&gt;
            &lt;string&gt;/usr/local/bin/terminal-notifier&lt;/string&gt;
            &lt;string&gt;-message&lt;/string&gt;
            &lt;string&gt;Test&lt;/string&gt;      
        &lt;/array&gt;
        &lt;key&gt;WatchPaths&lt;/key&gt;
        &lt;array&gt;
                &lt;string&gt;/Users/me/watchtest/&lt;/string&gt;
        &lt;/array&gt;
&lt;/dict&gt;
&lt;/plist&gt;


This works well for whatever changes happen under the watchtest folder.

But when I replace the WatchPaths key with the OmniFocus database, this does not work anymore (no notification are triggered):

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
  &lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;me.mayeu.script.OmniListen&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
      &lt;string&gt;/usr/local/bin/terminal-notifier&lt;/string&gt;
      &lt;string&gt;-message&lt;/string&gt;
      &lt;string&gt;Test&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;WatchPaths&lt;/key&gt;
    &lt;array&gt;
      &lt;string&gt;/Users/me/Library/Containers/com.omnigroup.OmniFocus3/Data/Library/Application\ Support/OmniFocus/OmniFocus.ofocus&lt;/string&gt;
    &lt;/array&gt;
  &lt;/dict&gt;
&lt;/plist&gt;


I have a feeling that this is due to the sandboxing of the app. But I can't find any documentation about that.

I am using macOS Mojave 10.14.2.
So I found the solution. And it has nothing to do with sandboxing, but everything to do with the fact that I had a \ in my path because I copied it over from the shell.

e.g.: .../Data/Library/Application\ Support/... should be .../Data/Library/Application Support/....