Sample Header Ad - 728x90

Triggering Launch Agents for path in sandboxed app using WatchPaths does not work

2 votes
1 answer
746 views
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.:
Label
        me.mayeu.helloworld
        ProgramArguments
        
		    /usr/local/bin/terminal-notifier
		    -message
		    Test      
        
        WatchPaths
        
                /Users/me/watchtest/
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):
Label
    me.mayeu.script.OmniListen
    ProgramArguments
    
      /usr/local/bin/terminal-notifier
      -message
      Test
    
    WatchPaths
    
      /Users/me/Library/Containers/com.omnigroup.OmniFocus3/Data/Library/Application\ Support/OmniFocus/OmniFocus.ofocus
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.
Asked by Mayeu (31 rep)
Jan 31, 2019, 09:33 AM
Last activity: Jan 31, 2019, 10:38 AM