In MAC OS, how to remove a Dock icon during uninstallation? Previously, I used to run the following AppleScript during uninstallation do to that,

    tell application "System Events"
        set dockPlistFile to property list file "~/Library/Preferences/com.apple.dock.plist"
        tell dockPlistFile
            tell property list item "persistent-apps"
                set appTileItems to value of (every property list item whose value of property list item "tile-data"'s property list item "file-label" is not "dockappname")
                set its value to appTileItems
            end tell
        end tell
    end tell
    tell application "Dock" to quit
end try

This worked in MAC OS Mountain Lion. But this not working on Mavericks and above. As explained in the answer in this link I know how to add a Dock icon. Is there a similar way in the new BitRock InstallBuilder version to remove it?

asked 28 Jan '16, 00:22

Codename%20K's gravatar image

Codename K
accept rate: 50%

We have been able to remove an icon from the Dock in OS X El Capitan by using a modified version of the bash script from this post in the Apple forums:

#Change name_of_app to the app you want to remove  
dloc=$(defaults read com.apple.dock persistent-apps | grep _CFURLString\" | awk '/name_of_app/ {print NR-1}')  
/usr/libexec/PlistBuddy -c "Delete persistent-apps:$dloc" ~/Library/Preferences/com.apple.dock.plist  
killall Dock

We had to subtract 1 to the index, as it seems to start counting on 0 but awk counts from 1. Could you check if it also works on previous version of OS X?


answered 28 Jan '16, 07:13

alejandror's gravatar image

alejandror ♦♦
accept rate: 31%

edited 28 Jan '16, 07:16

Can you send me that bash script to me please?

(28 Jan '16, 16:03) Codename K

The script is already included in my message. You would only need to write it to a file (substituting 'name_of_app' by the name of your app), set executable permissions for that file and execute it with bash.

(29 Jan '16, 04:37) alejandror ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 28 Jan '16, 00:22

Seen: 782 times

Last updated: 29 Jan '16, 04:37