Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Instructions to hide Finder & Trash items from macOS Dock

License

Notifications You must be signed in to change notification settings

echocrow/hide-macos-dock-items

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Hide Finder & Trash Dock Items

The following steps (should) allow you to hide the Finder and/or Trash items from your macOS Dock.

These instructions and scripts were successfully tested on macOS Catalina v10.15. Your milage may vary.

Instructions

Note: The following instructions will vary depending on whether your system is a n original macOS (e.g. a MacBook or iMac) or a Hackintosh. If you're not sure which one you're looking at, chances are it's a regular macOS installation (henceforce referred to as Regular macOS). Please follow the steps specific to your system.

  1. Disable System Integrity Protection:
    • Regular macOS:
      1. Boot into Recovery Mode:
        sudo nvram "recovery-boot-mode=unused"
        sudo reboot
      2. Once in Recovery Mode open the Terminal app (Utilities > Terminal).
      3. Disable SIP & reboot:
        csrutil disable
        reboot
    • Hackintosh: Odds are this is already enabled for your system. If you notice you cannot mount the System partition in writeable mode (see next steps), you may still need to disable SIP:
      1. Reboot your system and actiavte the Clover EFI Menu.
      2. Go to Options > System Parameters > System Integrity Protection.
      3. Enable the whole lot; one of them should do the trick.
      4. Select Return a couple times and boot into your system as you would normally.
  2. Open the Terminal app (other terminal apps are available) and change directory into this project folder. (This will be relevant later on.):
    cd /path/to/hide-macos-dock-items
  3. Mount the system partition in writeable mode:
    sudo mount -uw /
  4. Backup the original Dock PLIST file:
    sudo cp '/System/Library/CoreServices/Dock.app/Contents/Resources/DockMenus.plist' '/System/Library/CoreServices/Dock.app/Contents/Resources/DockMenus.backup.plist'
  5. Add Remove from Dock option to desired Dock item(s):
    1. Inject the Remove from Dock option for the Finder Dock item:
    sudo ./scripts/inject_dock_remove_option.sh '/System/Library/CoreServices/Dock.app/Contents/Resources/DockMenus.plist' 'finder-running'
    1. Inject the Remove from Dock option for the Trash Dock item:
    sudo ./scripts/inject_dock_remove_option.sh '/System/Library/CoreServices/Dock.app/Contents/Resources/DockMenus.plist' 'trash'
    You should now see a Remove from Dock option when right-clicking on the Finder or Trash item in your Dock (assuming you performed the associated injection step above).
  6. Reenable System Integrity Protection: This is optional, but strongly recommended.
    • Regular macOS:
      1. Boot into Recovery Mode:
        sudo nvram "recovery-boot-mode=unused"
        sudo reboot
      2. Once in Recovery Mode open the Terminal app (Utilities > Terminal).
      3. Disable SIP & reboot:
        csrutil enable
        reboot
    • Hackintosh: If you followed the steps from before to temporarily disable additional SIP options, no action is needed to restore the SIP configuration you had before. Simply reboot your system.
  7. Remove items on startup: The good news is, you should now be able to manually right-click on the Finder or Trash item in your Dock and choose Remove from Dock. The bad news is, after your next restart, the item(s) will be back. The context option will persist, but the action of removing the item will not. In order to work around this, we will set up a simple script that runs on boot and removes these items for us.
    • To automatically remove the Finder item:
      1. Update the file paths in the launch agent file to this project folder:
        sed -i '' 's|/path/to/|'$(pwd)'/scripts/|g' ./launchagents/local.bird.HideDockItems.Finder.plist
      2. Install launch script:
        cp ./launchagents/local.bird.HideDockItems.Finder.plist ~/Library/LaunchAgents/
        launchctl load ~/Library/LaunchAgents/local.bird.HideDockItems.Finder.plist
    • To automatically remove the Trash item:
      1. Update the file paths in the launch agent file to this project folder:
        sed -i '' 's|/path/to/|'$(pwd)'/scripts/|g' ./launchagents/local.bird.HideDockItems.Trash.plist
      2. Install launch script:
        cp ./launchagents/local.bird.HideDockItems.Trash.plist ~/Library/LaunchAgents/
        launchctl load ~/Library/LaunchAgents/local.bird.HideDockItems.Trash.plist

Undo Instructions

To restore the items and/or remove the Remove from Dock option follow these steps (provided you kept the .backup.plist file generated by the original instructions):

  1. Remove the startup scripts:
    launchctl unload ~/Library/LaunchAgents/local.bird.HideDockItems.Finder.plist
    rm ~/Library/LaunchAgents/local.bird.HideDockItems.Finder.plist
    launchctl unload ~/Library/LaunchAgents/local.bird.HideDockItems.Trash.plist
    rm ~/Library/LaunchAgents/local.bird.HideDockItems.Trash.plist
  2. Restore and delete the PLIST backup: (Note that for this step you may need to disable and later restore System Integrity Protection again. You can follow the approriate steps in the installation instructions above.)
    sudo mv '/System/Library/CoreServices/Dock.app/Contents/Resources/DockMenus.backup.plist' '/System/Library/CoreServices/Dock.app/Contents/Resources/DockMenus.plist'
  3. Restart the Dock app:
    killall Dock

Disclaimer

Follow these steps at your own risk, duh. I do not take any responsibility for any damage dealt to your system or data by the provided instructions or included scripts. As usual, please perform a system backup before attempting any system modifications.

Credit

I'm no wizzard, Harry, and couldn't have done this alone. Lots of individual steps and instructions were gratefully borrowed from other people:

About

Instructions to hide Finder & Trash items from macOS Dock

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published