17

Certain OSX apps seem to have a tendency to stick around in the Dock, even though there's no user-facing setting to prevent this behavior. Is there a defaults command that prevents apps from enabling "Keep in Dock?"

I know about defaults write com.apple.dock persistent-apps -array (intentionally empty), but this has to be run manually, and repeatedly. Any ideas?

  • How do You quit an app? If it was not kept in Dock before opening, hitting ⌘CMD + Q to close an app should remove icon form the Dock. – Mateusz Szlosek Jan 20 '16 at 18:58
  • To date (27 March, 2019) each of the answers here fails the actually does something test. I know this comment sounds negative, because it is, but at the same time maybe it can save somebody some disappointment. – Michael Wolf Mar 27 at 15:42
  • @MichaelWolf The highest voted answer (by @Shrihari) does what the OP is looking for. The question assumes that no UI exists to prevent the keep-in-dock behavior, thus they ask for a defaults command. That UI does exist tho and does exactly what is desired here. – Constablebrew May 22 at 6:11
  • @Constablebrew It doesn't. If you move an open app's position in the dock and then quit the app, its icon stays there, even if you have unchecked the option mentioned. – Michael Wolf May 22 at 16:46
  • 1
    @MichaelWolf Dragging an icon is explicitly setting its position, thus saving it to the dock (and over-riding any preferences). Setting the preference to not show recent apps in dock and also not dragging an app icon does just what OP is asking for - the app icon goes away when the app is closed. – Constablebrew Jul 12 at 0:25
28

I think I understand your problem.. Open System Preferences, Click on dock, uncheck "Show recent applications in dock". This should probably solve your problem.

1

Either the app needs to be quit with command+q, or you need to just drag the icon out of the dock, and it'll be gone.

  • No, there is a right click, "Remove from dock" item. I'm asking for preventing this from even being kept in the dock to begin with. – Kevin Suttle Jan 20 '16 at 19:56
  • 2
    @KevinSuttle it's not supposed to be. The only way it would happen is if the app's dock icon gets moved, or you right click on it and tell it to stay there. – William T Froggard Jan 20 '16 at 19:59
  • Aha, the "if the app's dock icon gets moved" is the trigger. I wonder if that behavior can be prevented. – Kevin Suttle Jan 20 '16 at 20:13
  • @WilliamTFroggard Our IT dept uses a utility called MacManage that will re-add the icon to the dock every 15 minutes, even if manually quit and unchecking keep in dock. – nipponese Apr 11 at 16:56
1

It seems like in Mojave (10.14) the following will do the trick:

defaults write com.apple.dock show-recents -bool no
defaults write com.apple.dock recent-apps -array # intentionally empty

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .