OSX terminal tricks

1. Pop up a message in the Finder

osascript -e ‘tell app "Finder" to display dialog "Hello World"

2. Make your computer talk

say hello

3. Change the location where screenshots are stored

defaults write com.apple.screencapture location /new_location_here

4. Show all hidden files by default

defaults write com.apple.finder AppleShowAllFiles true
killall Dock

# And hide them again with
defaults write com.apple.finder AppleShowAllFiles false
killall Dock

5. Prevent your computer from going to sleep for an extended period of time

caffeinate -t 3600 

6. Get Time Machine to back up every 30 minutes instead of every hour

sudo defaults write /System/Library/Launch Daemons/com.apple.backupd-auto StartInterval -int 1800

7. Add a login greeting banner (displayed to all users on the lock screen)

sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "Good Morning, Dave"

8. Make the icons on the dock massive

defaults write com.apple.dock largesize -int 512; killall Dock

9. Disable the startup chime

sudo nvram SystemAudioVolume=%80

10. Enable remote desktop (Screen Sharing/VNC) access to your computer (warning: this sets the password to “mypasswd.” It is highly recommended that you change this)

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -clientopts -setvnclegacy -vnclegacy yes -clientopts -setvncpw -vncpw mypasswd -restart -agent -privs -all

# Disable remote desktop

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -configure -access -off
Written on February 18, 2014