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.
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.
- Disable System Integrity Protection:
- Regular macOS:
- Boot into Recovery Mode:
sudo nvram "recovery-boot-mode=unused" sudo reboot
- Once in Recovery Mode open the Terminal app (Utilities > Terminal).
- Disable SIP & reboot:
csrutil disable reboot
- Boot into Recovery Mode:
- 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:
- Reboot your system and actiavte the Clover EFI Menu.
- Go to Options > System Parameters > System Integrity Protection.
- Enable the whole lot; one of them should do the trick.
- Select Return a couple times and boot into your system as you would normally.
- Regular macOS:
- 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
- Mount the system partition in writeable mode:
sudo mount -uw /
- 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'
- Add Remove from Dock option to desired Dock item(s):
- 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'
- Inject the Remove from Dock option for the Trash Dock item:
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).sudo ./scripts/inject_dock_remove_option.sh '/System/Library/CoreServices/Dock.app/Contents/Resources/DockMenus.plist' 'trash'
- Reenable System Integrity Protection:
This is optional, but strongly recommended.
- Regular macOS:
- Boot into Recovery Mode:
sudo nvram "recovery-boot-mode=unused" sudo reboot
- Once in Recovery Mode open the Terminal app (Utilities > Terminal).
- Disable SIP & reboot:
csrutil enable reboot
- Boot into Recovery Mode:
- 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.
- Regular macOS:
- 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:
- 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
- Install launch script:
cp ./launchagents/local.bird.HideDockItems.Finder.plist ~/Library/LaunchAgents/ launchctl load ~/Library/LaunchAgents/local.bird.HideDockItems.Finder.plist
- Update the file paths in the launch agent file to this project folder:
- To automatically remove the Trash item:
- 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
- Install launch script:
cp ./launchagents/local.bird.HideDockItems.Trash.plist ~/Library/LaunchAgents/ launchctl load ~/Library/LaunchAgents/local.bird.HideDockItems.Trash.plist
- Update the file paths in the launch agent file to this project folder:
- To automatically remove the Finder item:
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):
- 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
- 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'
- Restart the Dock app:
killall Dock
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.
I'm no wizzard, Harry, and couldn't have done this alone. Lots of individual steps and instructions were gratefully borrowed from other people: