MacOS – Apps in Dock creating new icon

dockmacos

I have just changed to Sierra – 10.12.4

Some apps (e.g. Aquamacs, Moneywell) in the Dock when you start them do not get a mark saying they are running but create a new icon that represents the running instance. This icon seems to have as its app one under /private/var/folders but with the correct app name not one in /Applications

Why is this happening and how can I get things back to how previous OSX versions worked.

Best Answer

The issue is caused by Gatekeeper. It uses "path randomization" to run applications, until the user moves the app in it's final destination (/Applications for example). This causes the app to be run from /private/var/.. and Dock treats this as a new app.

To remove the quarantine attribute execute (removes recursively com.apple.quarantine):

sudo xattr -dr com.apple.quarantine /Application/SomeApp.app

Recursion (the -r flag) may be needed for apps that contain helpers.

To list the current attributes for an app execute:

sudo xattr /Application/SomeApp.app

or

ls -l@d /Application/SomeApp.app

Sources:

On Gatekeeper and the Lifespan of Little Snitch Rules