Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
danielpunkass When an app is quarantined its bundle URL reflects its location on th…
…e translocated disk image Apple mounts and launches the app from. Instead, we want to always examine the original app location as the user sees it, so that we don't detect false positive movement by observing that the translocated position is different from the original.
Latest commit 403794c Sep 14, 2019


Gracefully handle user movement of a running Mac app. Read more on the Red Sweater Blog.


The modular design of Mac applications postpones the loading of resources until such time as they are needed. If after launching your app, a user moves or renames the app on disk, then future resource loads will fail because the bundle is still considered by app frameworks to exist at the old location.


One way to address this problem is by monitoring the location of the app bundle from within the app itself. When movement is detected, prompt the user to explain that they must relaunch the app, and then do it for them.


RSAppMovementMonitor handles the nuanced details of monitoring for the movement, prompting the user, and relaunching the app:

  1. Copy RSAppMovementMonitor.swift to your source base.
  2. Instantiate the class early in your app's lifetime:
var movementMonitor: RSAppMovementMonitor? = nil

func applicationDidFinishLaunching(_ aNotification: Notification) {
	movementMonitor = RSAppMovementMonitor()
  1. There's no step 3.

No Step 3?

The default functionality demands that a user unconditionally relaunch the app. This works well for most apps that take advantage of Apple's autosave technologies, such that quitting and reopening the app will not result in data loss.

If your app needs to customize the behavior, for example to only give the user a stern warning but leave them the option to keep running the app, you can provide a custom appMovementHandler which will be called when the app is moved.

What else?

Open and build the example app, "Cheese", to see an example of how to integrate the functionality, and how to provide a custom appMovementHandler.

You can’t perform that action at this time.