In an earlier post I mentioned that the
<SecuritySecurity/SecTranslocate.h> API had been removed from the 10.12 SDK in Xcode 8. However, yesterday I stumbled upon a different place where a kind of API for App Translocation still exists in macOS 10.12 Sierra: the
security command-line tool. It's not in the man page, so don't bother to RTFM, but you will find it at the end of the usage information, when you simply type
security into Terminal:
translocate-create Create a translocation point for the provided path translocate-policy-check Check whether a path would be translocated. translocate-status-check Check whether a path is translocated. translocate-original-path Find the original path for a translocated path.
In my testing, the commands seem to work as you would expect. For example, you can give a translocated app bundle path to the command
translocate-original-path to get the original bundle path in
~/Downloads. I can't imagine it would be fun to programmatically parse the command output though.
As always, follow my suggestions at your own risk. And if your device explodes, that's clearly not my fault.