13

I'm trying to find the terminal command which can remove an icon from the dock, but I can't find the solution.

I tried the defaults read / defaults write command but it doesn't seem to have the delete function.

The plist is com.apple.dock.

It's curious because the graphical function do it well, and I searched in the console, I don't find what the graphical function call.. I need to do find it to create a removal script..

defaults read com.apple.dock

Remove icon from dock with the graphic function

If someone have a solution, it could be cool.

Thanks

1

2 Answers 2

14

I recommend using dockutil for this. You can either download and install this directly from github, or you can install it using Homebrew with the command

brew install dockutil

Once installed, you can use a command like this to remove an app from the dock

dockutil --remove 'Microsoft Excel'
7

If you want to remove all icons, you can use this terminal command:

defaults write com.apple.dock persistent-apps -array
2
  • 1
    Followed by killall Dock to restart the now-empty Dock.
    – anothermh
    Commented Aug 15, 2023 at 21:41
  • this will fix most situations, basically cleans out the plist file in your preferences, however, MDM/MacosX Server administration profiles sometimes can leave some kind of shadow dock icons with '?' that seem to be a mystery of how they can be removed - especially if the MDM is no longer an active profile.
    – cgseller
    Commented Feb 15 at 0:53

You must log in to answer this question.

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