Skip to content

Instantly share code, notes, and snippets.

@infn8
Last active September 4, 2020 15:44
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infn8/8523902 to your computer and use it in GitHub Desktop.
Save infn8/8523902 to your computer and use it in GitHub Desktop.

Commands that will hide or show your desktop icons on a mac when double clicked.

Commands need to be executable so remember to chmod +x *.command in the folder you store these in.

Recently updated to include the line:

osascript -e 'tell application "Terminal" to close (every window whose name contains ".command")' 

so that the terminal windows don't hang around.

#!/bin/sh
defaults write com.apple.finder CreateDesktop -bool false
killall Finder
osascript -e 'tell application "Terminal" to close (every window whose name contains ".command")' &
exit
#!/bin/sh
defaults write com.apple.finder AppleShowAllFiles -boolean false
killall Finder
osascript -e 'tell application "Terminal" to close (every window whose name contains ".command")' &
exit
#!/bin/sh
chmod +x ~/Documents/commands/*.command
osascript -e 'tell application "Terminal" to close (every window whose name contains ".command")' &
exit
#!/bin/sh
defaults write com.apple.finder CreateDesktop -bool true
killall Finder
osascript -e 'tell application "Terminal" to close (every window whose name contains ".command")' &
exit
#!/bin/sh
defaults write com.apple.finder AppleShowAllFiles -boolean true
killall Finder
osascript -e 'tell application "Terminal" to close (every window whose name contains ".command")' &
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment