A curated list of shell commands and tools specific to OS X.
“You don’t have to know everything. You simply need to know where to find it when necessary.” (John Brunner)
If you want to contribute, you are highly encouraged to do so. Please read the contribution guidelines.
- Appearance
- Applications
- Backup
- Developer
- Disks and Volumes
- Documents
- Finder
- Fonts
- Hardware
- Input Devices
- Media
- Networking
- Package Managers
- Printing
- Security
- System
defaults write com.apple.universalaccess reduceTransparency -bool true
defaults write com.apple.universalaccess reduceTransparency -bool false
osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/path/to/picture.jpg"'
find /Applications -path '*Contents/_MASReceipt/receipt' -maxdepth 4 -print |\sed 's#.app/Contents/_MASReceipt/receipt#.app#g; s#/Applications/##'
sudo rm -rf /var/db/RemoteManagement
sudo rm /Library/Preferences/com.apple.RemoteDesktop.plist
rm ~/Library/Preferences/com.apple.RemoteDesktop.plist
sudo rm -r /Library/Application\ Support/Apple/Remote\ Desktop/
rm -r ~/Library/Application\ Support/Remote\ Desktop/
rm -r ~/Library/Containers/com.apple.RemoteDesktop
defaults write com.bohemiancoding.sketch3 exportCompactSVG -bool yes
xcode-select --install
This changes the interval to 30 minutes. The integer value is the time in seconds.
sudo defaults write /System/Library/Launch Daemons/com.apple.backupd-auto StartInterval -int 1800
hash tmutil &> /dev/null && sudo tmutil disablelocal
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
Leaving this turned on is useless when you're using SSDs.
sudo pmset -a sms 0
The only reliable way to do this is by sending an AppleScript command to Finder.
osascript -e 'tell application "Finder" to eject (every disk whose ejectable is true)'
hdiutil attach /path/to/diskimage.dmg
hdiutil detach /dev/disk2s1
You don't have to use the Disk Utility GUI for this.
sudo diskutil repairPermissions /
diskutil list
Supported formats are plain text, rich text (rtf) and Microsoft Word (doc/docx).
textutil -convert html file.ext
chflags hidden /path/to/folder/
Show All Hidden Files
defaults write com.apple.finder AppleShowAllFiles true
defaults write com.apple.finder AppleShowAllFiles false
chflags nohidden ~/Library
To clear font caches for all users, put sudo
in front of this command.
atsutil databases -removeUser && atsutil server -shutdown && atsutil server -ping
sudo pmset -a sms 0
networksetup -listallhardwareports
system_profiler SPDisplaysDataType | grep Resolution
sudo pmset -g
sudo pmset displaysleep 15
sudo pmset sleep 30
sudo systemsetup -getcomputersleep
sudo systemsetup -setcomputersleep 60
sudo systemsetup -setcomputersleep Never
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool true
defaults read -g NSAutomaticSpellingCorrectionEnabled
afconvert input.mp3 ringtone.m4r -f m4af
You can play all audio formats that are natively supported by QuickTime.
afplay -q 1 filename.mp3
defaults write /System/Library/LaunchDaemons/com.apple.mDNSResponder ProgramArguments -array "/usr/sbin/mDNSResponder" "-launchd"
defaults write /System/Library/LaunchDaemons/com.apple.mDNSResponder ProgramArguments -array-add "-NoMulticastAdvertisements"
sudo ipconfig set en0 DHCP
ipconfig getpacket en0
sudo dscachutil -flushcache && sudo killall -HUP mDNSResponder
ping -o github.com
traceroute github.com
defaults read /Library/Preferences/SystemConfiguration/com.apple.airport.preferences | grep LastConnected -A 7
security find-generic-password -ga "ROUTERNAME" | grep "password:"
- Fink - The full world of Unix Open Source software for Darwin.
- Homebrew - The missing package manager for OS X.
- MacPorts - Compile, install and upgrade either command-line, X11 or Aqua based open-source software.
cancel -a -
spctl --add /path/to/Application.app
spctl --remove /path/to/Application.app
First, install pwgen
via Homebrew, etc.
pwgen -Cs 20 1 | tr -d ' ' | tr -d '\n' | pbcopy
srm /path/to/file
srm -r /path/to/directory/
srm -rf /path/to/complete/destruction
sudo reboot
sudo poweroff
sw_vers
cat whatever.txt | pbcopy
pbpaste | expand | pbcopy
pbpaste > whatever.txt
pbpaste | sort | uniq | pbcopy
sudo fdesetup status
sudo sysdiagnose -f ~/Desktop/
sudo kextload -b com.apple.driver.ExampleBundle
sudo kextunload -b com.apple.driver.ExampleBundle
sudo purge
launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist && killall -9 NotificationCenter
launchctl load -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
dsenableroot
dsenableroot -d
nvram boot-args
sudo nvram boot-args="-x"
sudo nvram boot-args=""
installer -pkg /path/to/installer.pkg -target /
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.