MacOS – How to show Hard Disk icon on Desktop via Terminal

finderhard drivemacosterminal

Is there a command in Terminal that allows you to show the Hard Disk as an icon on your Desktop?

I know the manual process of doing it, which is, Finder > Preferences… > General and check "Hard disks" under "Show these items on the desktop:", but I want to be able to apply this configuration through the command line.

Any help is greatly appreciated, thanks!

Best Answer

To show various drive icons on the desktop use the following commands in Terminal:

External hard drives:

defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true

Hard drives:

defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true

Removable media:

defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true

(To complete all options available in the Finder preferences: mounted servers:)

defaults write com.apple.finder ShowMountedServersOnDesktop -bool true

Afterwards restart the Finder:

killall -HUP Finder

To disable showing the respective desktop icons simply replace true by false