The Finder Really Should Prevent Moving Running Applications
Posted By Paul Kafasis on September 6th, 2019
Yesterday, I wrote about how our software works to avoid issues if the application is moved while its in use. We shared some code for this which could be useful to other Mac developers, and Daniel Jalkut produced a more robust drop-in, which all Mac developers should check out.
Our products have handled this issue well enough for many years, and we were generally content with our solution. However, due to changes made in MacOS 10.15 (Catalina), we recently had to dumb down our approach. For years we used GCD (dispatch) to observe the application’s folder, as well as parent folders, to see if they moved. This doesn’t work very well on Catalina, where if the application is residing in the Downloads folder, the OS thinks the user needs to be warned we are “accessing” the Downloads area. To avoid frightening users with unnecessary security dialogs, our solution is now less robust than it once was.
After discussing all of this with Daniel, we came to the realization that this really isn’t something individual developers ought to need to handle at all. Instead, it makes the most sense for Apple to help users avoid this issue at the Finder level.
As much as one might want to move a running application, Apple’s Cocoa framework is simply is unable to correctly handle the situation at present. This leads to unexpected application behaviors and even crashes. To avoid these issues, the Finder already works to avoid multiple types of changes to running applications. For instance, if you try to delete an application that’s open, the Finder stops you:
As well, if you attempt to rename an open application, the Finder will warn against it:
This dialog allows you to proceed with the rename (and even makes that action the default), but it at least provides a warning that this action is not be advisable.
However, while any Unix geek can tell you that a rename is really just a move by another name, the Finder does nothing to stop you from actually moving the app. This seems like a real oversight, and something that can and should be fixed on Apple’s end.
I opted to file a bug with Apple about this (#FB7216674). Perhaps developers will one day see the Finder handling this for us.