How to enforce sandbox rules for the particular app? I wrote an sandbox specification file (inspired by files from /usr/share/sandbox and manuals like this) and now I can launch some app in sandbox with sandbox-exec $path_to_rules /Applications/$appname.app/Content/.... Fine.

Is there a way to enforce the rules when the app is started in regular way (Finder's "Open with...", etc)?

I thought about replacing the binary inside .app with wrapper script but it will be overwritten after app update and I will need to restore it every time.
Yes, you can change the binary, or even change the Info.plist, but like changing the binary you make will need to do this again each time the app is updated. There's no way to do this without changing the app in a way that won't be overwritten when it's updated.

You can automatically make your changes with a Launch Agent.
Save the following in ~/Library/LaunchAgents as com.yourname.youragent.plist, then run launchctl load ~/Library/LaunchAgents/com.yourname.youragent.plist.

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple Computer//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;com.yourname.youragent&lt;/string&gt;
        &lt;key&gt;OnDemand&lt;/key&gt;
        &lt;true/&gt;
        &lt;key&gt;Program&lt;/key&gt;
        &lt;string&gt;cp&lt;/string&gt;
        &lt;key&gt;ProgramArguments&lt;/key&gt;
        &lt;array&gt;
            &lt;string&gt;/Users/grgarside/test/MyApp&lt;/string&gt;
            &lt;string&gt;/Applications/MyApp.app/Contents/MacOS/&lt;/string&gt;
        &lt;/array&gt;
        &lt;key&gt;WatchPaths&lt;/key&gt;
        &lt;array&gt;
            &lt;string&gt;/Applications/MyApp.app/Contents/MacOS/MyApp&lt;/string&gt;
        &lt;/array&gt;
    &lt;/dict&gt;
&lt;/plist&gt;


The above script will watch the WatchPaths for any modifications (in this case, it's watching the binary for an app) and will run cp to copy your binary to the app in /Applications.