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 truedefaults write com.apple.universalaccess reduceTransparency -bool falseosascript -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.RemoteDesktopdefaults write com.bohemiancoding.sketch3 exportCompactSVG -bool yesxcode-select --installThis 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 1800hash tmutil &> /dev/null && sudo tmutil disablelocaldefaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool trueLeaving this turned on is useless when you're using SSDs.
sudo pmset -a sms 0The 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.dmghdiutil detach /dev/disk2s1You don't have to use the Disk Utility GUI for this.
sudo diskutil repairPermissions /diskutil listSupported formats are plain text, rich text (rtf) and Microsoft Word (doc/docx).
textutil -convert html file.extchflags hidden /path/to/folder/Show All Hidden Files
defaults write com.apple.finder AppleShowAllFiles truedefaults write com.apple.finder AppleShowAllFiles falsechflags nohidden ~/LibraryTo clear font caches for all users, put sudo in front of this command.
atsutil databases -removeUser && atsutil server -shutdown && atsutil server -pingsudo pmset -a sms 0networksetup -listallhardwareportssystem_profiler SPDisplaysDataType | grep Resolutionsudo pmset -gsudo pmset displaysleep 15sudo pmset sleep 30sudo systemsetup -getcomputersleepsudo systemsetup -setcomputersleep 60sudo systemsetup -setcomputersleep Neverdefaults write -g NSAutomaticSpellingCorrectionEnabled -bool falsedefaults write -g NSAutomaticSpellingCorrectionEnabled -bool truedefaults read -g NSAutomaticSpellingCorrectionEnabledafconvert input.mp3 ringtone.m4r -f m4afYou can play all audio formats that are natively supported by QuickTime.
afplay -q 1 filename.mp3defaults 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 DHCPipconfig getpacket en0sudo dscachutil -flushcache && sudo killall -HUP mDNSResponderping -o github.comtraceroute github.comdefaults read /Library/Preferences/SystemConfiguration/com.apple.airport.preferences | grep LastConnected -A 7security 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.appspctl --remove /path/to/Application.appFirst, install pwgen via Homebrew, etc.
pwgen -Cs 20 1 | tr -d ' ' | tr -d '\n' | pbcopysrm /path/to/filesrm -r /path/to/directory/srm -rf /path/to/complete/destructionsudo rebootsudo poweroffsw_verscat whatever.txt | pbcopypbpaste | expand | pbcopypbpaste > whatever.txtpbpaste | sort | uniq | pbcopysudo fdesetup statussudo sysdiagnose -f ~/Desktop/sudo kextload -b com.apple.driver.ExampleBundlesudo kextunload -b com.apple.driver.ExampleBundlesudo purgelaunchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist && killall -9 NotificationCenterlaunchctl load -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plistdsenablerootdsenableroot -dnvram boot-argssudo 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.
