Use your OS X terminal shell to do awesome things.
Latest commit 9121931 Mar 9, 2017 @clarketm clarketm committed with Update (#159)
fix broken path: remove erroneous space between `Launch` and `Daemons`

Awesome OS X Command Line

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)

Awesome Build Status

If you want to contribute, you are highly encouraged to do so. Please read the contribution guidelines.

For more terminal shell goodness, please also see this list's sister list Awesome Command Line Apps.

Table of Contents



Transparency in Menu and Windows

# Reduce Transparency
defaults write reduceTransparency -bool true

# Restore Default Transparency
defaults write reduceTransparency -bool false


Set Wallpaper

# Up to Mountain Lion
osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/path/to/picture.jpg"'

# Since Mavericks
sqlite3 ~/Library/Application\ Support/Dock/desktoppicture.db "update data set value = '/path/to/picture.jpg'" && killall Dock


App Store

List All Apps Downloaded from App Store

# Via find
find /Applications -path '*Contents/_MASReceipt/receipt' -maxdepth 4 -print |\sed '; s#/Applications/##'

# Via Spotlight
mdfind kMDItemAppStoreHasReceipt=1

Show Debug Menu

# Enable
defaults write ShowDebugMenu -bool true

# Disable (Default)
defaults write ShowDebugMenu -bool false

Apple Remote Desktop

Remove Apple Remote Desktop Settings

sudo rm -rf /var/db/RemoteManagement ; \
sudo defaults delete /Library/Preferences/ ; \
defaults delete ~/Library/Preferences/ ; \
sudo rm -r /Library/Application\ Support/Apple/Remote\ Desktop/ ; \
rm -r ~/Library/Application\ Support/Remote\ Desktop/ ; \
rm -r ~/Library/Containers/


Debug Mode

# Enable
defaults write ABShowDebugMenu -bool true

# Disable (Default)
defaults write ABShowDebugMenu -bool false


Uninstall Google Update

~/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Resources/ksinstall --nuke


Keyboard Media Keys

# Stop Responding to Key Presses
launchctl unload -w /System/Library/LaunchAgents/

# Respond to Key Presses (Default)
launchctl load -w /System/Library/LaunchAgents/


Show Attachments as Icons

defaults write DisableInlineAttachmentViewing -bool yes

Vacuum Mail Index

The AppleScript code below will quit Mail, vacuum the SQLite index, then re-open Mail. On a large email database that hasn't been optimized for a while, this can provide significant improvements in responsiveness and speed.

Speed up by vacuuming the Envelope Index
Code from:
Originally by "pmbuko" with modifications by Romulo
Updated by Brett Terpstra 2012
Updated by Mathias Törnblom 2015 to support V3 in El Capitan and still keep backwards compatibility
Updated by Andrei Miclaus 2017 to support V4 in Sierra

tell application "Mail" to quit
set os_version to do shell script "sw_vers -productVersion"
set mail_version to "V2"
considering numeric strings
    if "10.10" <= os_version then set mail_version to "V3"
    if "10.12" < os_version then set mail_version to "V4"
end considering

set sizeBefore to do shell script "ls -lnah ~/Library/Mail/" & mail_version & "/MailData | grep -E 'Envelope Index$' | awk {'print $5'}"
do shell script "/usr/bin/sqlite3 ~/Library/Mail/" & mail_version & "/MailData/Envelope\\ Index vacuum"

set sizeAfter to do shell script "ls -lnah ~/Library/Mail/" & mail_version & "/MailData | grep -E 'Envelope Index$' | awk {'print $5'}"

display dialog ("Mail index before: " & sizeBefore & return & "Mail index after: " & sizeAfter & return & return & "Enjoy the new speed!")

tell application "Mail" to activate


Enable Develop Menu and Web Inspector

defaults write IncludeInternalDebugMenu -bool true && \
defaults write IncludeDevelopMenu -bool true && \
defaults write WebKitDeveloperExtrasEnabledPreferenceKey -bool true && \
defaults write -bool true && \
defaults write -g WebKitDeveloperExtras -bool true

Get Current Page Data

Other options: get source, get text.

osascript -e 'tell application "Safari" to get URL of current tab of front window'


Export Compact SVGs

defaults write com.bohemiancoding.sketch3 exportCompactSVG -bool yes


Turn Off Auto Reload Dialog

Removes the dialog and defaults to auto reload.

defaults write -app Skim SKAutoReloadFileUpdate -boolean true


Use Plain Text Mode as Default

defaults write RichText -int 0


Time Machine

Change Backup Interval

This changes the interval to 30 minutes. The integer value is the time in seconds.

sudo defaults write /System/Library/LaunchDaemons/ StartInterval -int 1800

Local Backups

Whether Time Machine performs local backups while the Time Machine backup volume is not available.

# Status
defaults read /Library/Preferences/ MobileBackups

# Enable (Default)
sudo tmutil enablelocal

# Disable
sudo tmutil disablelocal

Prevent Time Machine from Prompting to Use New Hard Drives as Backup Volume

sudo defaults write /Library/Preferences/ DoNotOfferNewDisksForBackup -bool true

Verify Backup

Beginning in OS X 10.11, Time Machine records checksums of files copied into snapshots. Checksums are not retroactively computed for files that were copied by earlier releases of OS X.

sudo tmutil verifychecksums /path/to/backup



Compile Sane Vim

Compiling MacVim via Homebrew with all bells and whistles, including overriding system Vim.

brew install macvim --HEAD --with-cscope --with-lua --with-override-system-vim --with-luajit --with-python


Install the development version of this modern Vim drop-in alternative via Homebrew.

brew install neovim/neovim/neovim


Install Command Line Tools without Xcode

xcode-select --install

Remove All Unavailable Simulators

xcrun simctl delete unavailable


Add a Stack with Recent Applications

defaults write persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }' && \
killall Dock

Add a Space

defaults write persistent-apps -array-add '{"tile-type"="spacer-tile";}' && \
killall Dock

Auto Rearrange Spaces Based on Most Recent Use

# Enable (Default)
defaults write mru-spaces -bool true && \
killall Dock

# Disable
defaults write mru-spaces -bool false && \
killall Dock

Icon Bounce

Global setting whether Dock icons should bounce when the respective application demands your attention.

# Enable (Default)
defaults write no-bouncing -bool true && \
killall Dock

# Disable
defaults write no-bouncing -bool false && \
killall Dock

Reset Dock

defaults delete && \
killall Dock


Fully resize your Dock's body. To resize change the 0 value as an integer.

defaults write tilesize -int 0 && \
killall Dock

Scroll Gestures

Use your touchpad or mouse scroll wheel to interact with Dock items. Allows you to use an upward scrolling gesture to open stacks. Using the same gesture on applications that are running invokes Exposé/Mission Control.

# Enable
defaults write scroll-to-open -bool true && \
killall Dock

# Disable (Default)
defaults write scroll-to-open -bool false && \
killall Dock

Set Auto Show/Hide Delay

The float number defines the show/hide delay in ms.

defaults write autohide-delay -float 0 && \
killall Dock

Show Hidden App Icons

# Enable
defaults write showhidden -bool true && \
killall Dock

# Disable (Default)
defaults write showhidden -bool false && \
killall Dock


Convert File to HTML

Supported formats are plain text, rich text (rtf) and Microsoft Word (doc/docx).

textutil -convert html file.ext

Files, Disks and Volumes

Create an Empty File

Creates an empty 10 gigabyte test file.

mkfile 10g /path/to/file

Disable Sudden Motion Sensor

Leaving this turned on is useless when you're using SSDs.

sudo pmset -a sms 0

Eject All Mountable Volumes

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)'

Repair File Permissions

You don't have to use the Disk Utility GUI for this.

sudo diskutil repairPermissions /

Beginning with OS X El Capitan, system file permissions are automatically protected. It's no longer necessary to verify or repair permissions with Disk Utility. (Source)

Set Boot Volume

bless --mount "/path/to/mounted/volume" --setBoot

Show All Attached Disks and Partitions

diskutil list

View File System Usage

A continuous stream of file system access info.

sudo fs_usage

Disk Images

Create Disk Image From Folder Contents

hdiutil create -volname "Volume Name" -srcfolder /path/to/folder -ov diskimage.dmg

If you'd like to encrypt the disk image:

hdiutil create -encryption -stdinpass -volname "Volume Name" -srcfolder /path/to/folder -ov encrypted.dmg

By default, you'll be prompted for a password. You can automate that by piping in a password:

echo -n YourPassword | hdiutil create -encryption -stdinpass -volname "Volume Name" -srcfolder /path/to/folder -ov encrypted.dmg

Burn Disk Images to DVD

This command applies to .iso, .img and .dmg images.

hdiutil burn /path/to/image_file

Disable Disk Image Verification

defaults write skip-verify -bool true && \
defaults write skip-verify-locked -bool true && \
defaults write skip-verify-remote -bool true

Make Volume OS X Bootable

bless --folder "/path/to/mounted/volume/System/Library/CoreServices" --bootinfo --bootefi

Mount Disk Image

hdiutil attach /path/to/diskimage.dmg

Unmount Disk Image

hdiutil detach /dev/disk2s1

Write Disk Image to Volume

Like the Disk Utility "Restore" function.

sudo asr -restore -noverify -source /path/to/diskimage.dmg -target /Volumes/VolumeToRestoreTo


Convert File to HTML

Supported formats are plain text, rich text (rtf) and Microsoft Word (doc/docx).

textutil -convert html file.ext


Files and Folders

Clear All ACLs

sudo chmod -RN /path/to/folder

Hide Folder in Finder

chflags hidden /path/to/folder/

Show All File Extensions

defaults write -g AppleShowAllExtensions -bool true

Show Hidden Files

# Show All
defaults write AppleShowAllFiles true

# Restore Default File Visibility
defaults write AppleShowAllFiles false

Remove Protected Flag

sudo chflags -R nouchg /path/to/file/or/folder

Show Full Path in Finder Title

defaults write _FXShowPosixPathInTitle -bool true

Unhide User Library Folder

chflags nohidden ~/Library

Increase Number of Recent Places

defaults write -g NSNavRecentPlacesLimit -int 10 && \
killall Finder


Show "Quit Finder" Menu Item

Makes possible to see Finder menu item "Quit Finder" with default shortcut Cmd + Q

# Enable
defaults write QuitMenuItem -bool true && \
killall Finder

# Disable (Default)
defaults write QuitMenuItem -bool false && \
killall Finder

Smooth Scrolling

Useful if you’re on an older Mac that messes up the animation.

# Disable
defaults write -g NSScrollAnimationEnabled -bool false

# Enable (Default)
defaults write -g NSScrollAnimationEnabled -bool true

Rubberband Scrolling

# Disable
defaults write -g NSScrollViewRubberbanding -bool false

# Enable (Default)
defaults write -g NSScrollViewRubberbanding -bool true

Expand Save Panel by Default

defaults write -g NSNavPanelExpandedStateForSaveMode -bool true && \
defaults write -g NSNavPanelExpandedStateForSaveMode2 -bool true

Desktop Icon Visibility

# Hide Icons
defaults write CreateDesktop -bool false && \
killall Finder

# Show Icons (Default)
defaults write CreateDesktop -bool true && \
killall Finder

Path Bar

# Show
defaults write ShowPathbar -bool true

# Hide (Default)
defaults write ShowPathbar -bool false

Scrollbar Visibility

Possible values: WhenScrolling, Automatic and Always.

defaults write -g AppleShowScrollBars -string "Always"

Status Bar

# Show
defaults write ShowStatusBar -bool true

# Hide (Default)
defaults write ShowStatusBar -bool false

Save to Disk by Default

Sets default save target to be a local disk, not iCloud.

defaults write -g NSDocumentSaveNewDocumentsToCloud -bool false

Set Current Folder as Default Search Scope

defaults write FXDefaultSearchScope -string "SCcf"

Set Default Finder Location to Home Folder

defaults write NewWindowTarget -string "PfLo" && \
defaults write NewWindowTargetPath -string "file://${HOME}"

Set Sidebar Icon Size

Sets size to 'medium'.

defaults write -g NSTableViewDefaultSizeMode -int 2

Metadata Files

Disable Creation of Metadata Files on Network Volumes

Avoids creation of .DS_Store and AppleDouble files.

defaults write DSDontWriteNetworkStores -bool true

Disable Creation of Metadata Files on USB Volumes

Avoids creation of .DS_Store and AppleDouble files.

defaults write DSDontWriteUSBStores -bool true

Opening Things

Change Working Directory to Finder Path

If multiple windows are open, it chooses the top-most one.

cd "$(osascript -e 'tell app "Finder" to POSIX path of (insertion location as alias)')"

Open URL


Open File


Open Applications

You can open applications using -a.

open -a "Google Chrome"

Open Folder

open /path/to/folder/

Open Current Folder

open .


Clear Font Cache for Current User

To clear font caches for all users, put sudo in front of this command.

atsutil databases -removeUser && \
atsutil server -shutdown && \
atsutil server -ping

Get SF Mono Fonts

You need to download and install Xcode 8 beta for this to work. Afterwards they should be available in all applications.

cp -v /Applications/* ~/Library/Fonts

From Sierra onward, they are included in

cp -v /Applications/Utilities/* ~/Library/Fonts


Please see this file.



# Status
defaults read /Library/Preferences/ ControllerPowerState

# Enable (Default)
sudo defaults write /Library/Preferences/ ControllerPowerState -int 1

# Disable
sudo defaults write /Library/Preferences/ ControllerPowerState -int 0 && \
sudo killall -HUP blued

Hardware Information

List All Hardware Ports

networksetup -listallhardwareports

Remaining Battery Percentage

pmset -g batt | egrep "([0-9]+\%).*" -o --colour=auto | cut -f1 -d';'

Remaining Battery Time

pmset -g batt | egrep "([0-9]+\%).*" -o --colour=auto | cut -f3 -d';'

Show Connected Device's UDID

system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p'

Show Current Screen Resolution

system_profiler SPDisplaysDataType | grep Resolution

Show CPU Brand String

sysctl -n machdep.cpu.brand_string

Infrared Receiver

# Status
defaults read /Library/Preferences/ DeviceEnabled

# Enable (Default)
defaults write /Library/Preferences/ DeviceEnabled -int 1

# Disable
defaults write /Library/Preferences/ DeviceEnabled -int 0

Power Management

Prevent System Sleep

Prevent sleep for 1 hour:

caffeinate -u -t 3600

Show All Power Management Settings

sudo pmset -g

Put Display to Sleep after 15 Minutes of Inactivity

sudo pmset displaysleep 15

Put Computer to Sleep after 30 Minutes of Inactivity

sudo pmset sleep 30

Check System Sleep Idle Time

sudo systemsetup -getcomputersleep

Set System Sleep Idle Time to 60 Minutes

sudo systemsetup -setcomputersleep 60

Turn Off System Sleep Completely

sudo systemsetup -setcomputersleep Never

Automatic Restart on System Freeze

sudo systemsetup -setrestartfreeze on

Chime When Charging

Play iOS charging sound when MagSafe is connected.

# Enable
defaults write ChimeOnAllHardware -bool true && \
open /System/Library/CoreServices/

# Disable (Default)
defaults write ChimeOnAllHardware -bool false && \
killall PowerChime

Input Devices



# Disable
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false

# Enable (Default)
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool true

# Show Status
defaults read -g NSAutomaticSpellingCorrectionEnabled

Full Keyboard Access

Enable Tab in modal dialogs.

# Text boxes and lists only (Default)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 0

# All controls
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3

Key Repeat

Disable the default "press and hold" behavior.

# Enable Key Repeat
defaults write -g ApplePressAndHoldEnabled -bool false

# Disable Key Repeat
defaults write -g ApplePressAndHoldEnabled -bool true

Key Repeat Rate

Sets a very fast repeat rate, adjust to taste.

defaults write -g KeyRepeat -int 0.02



Convert Audio File to iPhone Ringtone

afconvert input.mp3 ringtone.m4r -f m4af

Create Audiobook From Text

Uses "Alex" voice, a plain UTF-8 encoded text file for input and AAC output.

say -v Alex -f file.txt -o "output.m4a"

Disable Sound Effects on Boot

sudo nvram SystemAudioVolume=" "

Mute Audio Output

osascript -e 'set volume output muted true'

Set Audio Volume

osascript -e 'set volume 4'

Play Audio File

You can play all audio formats that are natively supported by QuickTime.

afplay -q 1 filename.mp3

Speak Text with System Default Voice

say 'All your base are belong to us!'


Auto-Play Videos in QuickTime Player

defaults write MGPlayMovieOnOpen 1



Bonjour Service

# Disable
sudo defaults write /System/Library/LaunchDaemons/ ProgramArguments -array-add "-NoMulticastAdvertisements"

# Enable (Default)
sudo defaults write /System/Library/LaunchDaemons/ ProgramArguments -array "/usr/sbin/mDNSResponder" "-launchd"


Renew DHCP Lease

sudo ipconfig set en0 DHCP

Show DHCP Info

ipconfig getpacket en0


Clear DNS Cache

sudo dscacheutil -flushcache && \
sudo killall -HUP mDNSResponder


Set Computer Name/Host Name

sudo scutil --set ComputerName "newhostname" && \
sudo scutil --set HostName "newhostname" && \
sudo scutil --set LocalHostName "newhostname" && \
sudo defaults write /Library/Preferences/SystemConfiguration/ NetBIOSName -string "newhostname"

Network Preferences

Network Locations

Switch between network locations created in the Network preference pane.

# Status

# Switch Network Location
scselect LocationNameFromStatus

Networking Tools

Ping a Host to See Whether It’s Available

ping -o

Troubleshoot Routing Problems



Remote Login

# Enable remote login
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist

# Disable remote login
sudo launchctl unload -w /System/Library/LaunchDaemons/ssh.plist


Show Application Using a Certain Port

This outputs all applications currently using port 80.

sudo lsof -i :80

Show External IP Address

dig +short


Start Native TFTP Daemon

Files will be served from /private/tftpboot.

sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist && \
sudo launchctl start


Join a Wi-Fi Network

networksetup -setairportnetwork en0 WIFI_SSID WIFI_PASSWORD

Scan Available Access Points

Create a symbolic link to the airport command for easy access:

sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport

Run a wireless scan:

airport -s

Show Current SSID

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'

Show Local IP Address

ipconfig getifaddr en0

Show Wi-Fi Connection History

defaults read /Library/Preferences/SystemConfiguration/ | grep LastConnected -A 7

Show Wi-Fi Network Passwords

Exchange SSID with the SSID of the access point you wish to query the password from.

security find-generic-password -D "AirPort network password" -a "SSID" -gw

Turn on Wi-Fi Adapter

networksetup -setairportpower en0 on

Package Managers

  • Fink - The full world of Unix Open Source software for Darwin. A little outdated.
  • Homebrew - The missing package manager for OS X. The most popular choice.
  • MacPorts - Compile, install and upgrade either command-line, X11 or Aqua based open-source software. Very clean, it's what I use.


Clear Print Queue

cancel -a -

Expand Print Panel by Default

defaults write -g PMPrintingExpandedStateForPrint -bool true && \
defaults write -g PMPrintingExpandedStateForPrint2 -bool true

Quit Printer App After Print Jobs Complete

defaults write "Quit When Finished" -bool true


Application Firewall

Firewall Service

# Show Status
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate

# Enable
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on

# Disable (Default)
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off

Add Application to Firewall

sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /path/to/file


Add Gatekeeper Exception

spctl --add /path/to/

Remove Gatekeeper Exception

spctl --remove /path/to/

Manage Gatekeeper

# Status
spctl --status

# Enable (Default)
sudo spctl --master-enable

# Disable
sudo spctl --master-disable


Generate Secure Password and Copy to Clipboard

LC_ALL=C tr -dc "[:alpha:][:alnum:]" < /dev/urandom | head -c 20 | pbcopy

Physical Access

Launch Screen Saver

open /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/

Lock Screen

/System/Library/CoreServices/Menu\ Extras/ -suspend

Screensaver Immediate Lock

# Status
defaults read askForPasswordDelay

# Enable (Default)
defaults write askForPasswordDelay -int 0

# Disable (Integer = lock delay in seconds)
defaults write askForPasswordDelay -int 10

Screensaver Password

# Status
defaults read askForPassword

# Enable
defaults write askForPassword -int 1

# Disable (Default)
defaults write askForPassword -int 0

Wiping Data

Note: The srm command appears to have been removed on MacOS after 10.9. There is a note on an Apple support page hinting as to why:

With an SSD drive, Secure Erase and Erasing Free Space are not available in Disk Utility. These options are not needed for an SSD drive because a standard erase makes it difficult to recover data from an SSD.

Securely Remove File

srm /path/to/file

Securely Remove Folder

srm -r /path/to/folder/

Securely Remove Path (Force)

srm -rf /path/to/complete/destruction



Recursively Delete .DS_Store Files

find . -type f -name '*.DS_Store' -ls -delete


Build Locate Database

sudo launchctl load -w /System/Library/LaunchDaemons/

Search via Locate

The -i modifier makes the search case insensitive.

locate -i *.jpg



# Enable AirDrop over Ethernet and on Unsupported Macs
defaults write BrowseAllInterfaces -bool true

# Enable (Default)
defaults remove DisableAirDrop

# Disable
defaults write DisableAirDrop -bool YES


Execute AppleScript

osascript /path/to/script.scpt


Compare Two Folders

diff -qr /path/to/folder1 /path/to/folder2

Copy Large File with Progress

Make sure you have pv installed and replace /dev/rdisk2 with the appropriate write device or file.

FILE=/path/to/file.iso pv -s $(du -h $FILE | awk '/.*/ {print $1}') $FILE | sudo dd of=/dev/rdisk2 bs=1m

Restore Sane Shell

In case your shell session went insane (some script or application turned it into a garbled mess).

stty sane


sudo reboot


sudo poweroff

Show Build Number of OS



How long since your last restart.



Copy data to Clipboard

cat whatever.txt | pbcopy

Convert Clipboard to Plain Text

pbpaste | textutil -convert txt -stdin -stdout -encoding 30 | pbcopy

Convert Tabs to Spaces for Clipboard Content

pbpaste | expand | pbcopy

Copy data from Clipboard

pbpaste > whatever.txt

Sort and Strip Duplicate Lines from Clipboard Content

pbpaste | sort | uniq | pbcopy


Automatically Unlock FileVault on Restart

If FileVault is enabled on the current volume, it restarts the system, bypassing the initial unlock. The command may not work on all systems.

sudo fdesetup authrestart

FileVault Service

# Status
sudo fdesetup status

# Enable
sudo fdesetup enable

# Disable (Default)
sudo fdestatus disable


Generate Advanced System and Performance Report

sudo sysdiagnose -f ~/Desktop/

Install OS

Create Bootable Installer

# El Capitan
sudo /Applications/Install\ OS\ X\ El\ --volume /Volumes/MyVolume --applicationpath /Applications/Install\ OS\ X\ El\

# Yosemite
sudo /Applications/Install\ OS\ X\ --volume /Volumes/MyVolume --applicationpath /Applications/Install\ OS\ X\

# Mavericks
sudo /Applications/Install\ OS\ X\ --volume /Volumes/MyVolume --applicationpath /Applications/Install\ OS\ X\

Kernel Extensions

Display Status of Loaded Kernel Extensions

sudo kextstat -l

Load Kernel Extension

sudo kextload -b

Unload Kernel Extensions

sudo kextunload -b


Please see this file.


Rebuild LaunchServices Database

To be independent of OS X version, this relies on locate to find lsregister. If you do not have your locate database built yet, do it.

sudo $(locate lsregister) -kill -seed -r

Login Window

Set Login Window Text

sudo defaults write /Library/Preferences/ LoginwindowText "Your text"

Memory Management

Purge memory cache

sudo purge

Show Memory Statistics

# One time

# Table of data, repeat 10 times total, 1 second wait between each poll
vm_stat -c 10 1

Notification Center

Notification Center Service

# Disable
launchctl unload -w /System/Library/LaunchAgents/ && \
killall -9 NotificationCenter

# Enable (Default)
launchctl load -w /System/Library/LaunchAgents/


Preview via QuickLook

qlmanage -p /path/to/file

Remote Apple Events

# Status
sudo systemsetup -getremoteappleevents

# Enable
sudo systemsetup -setremoteappleevents on

# Disable (Default)
sudo systemsetup -setremoteappleevents off

Root User

# Enable

# Disable
dsenableroot -d

Safe Mode Boot

# Status
nvram boot-args

# Enable
sudo nvram boot-args="-x"

# Disable
sudo nvram boot-args=""


Take Delayed Screenshot

Takes a screenshot as JPEG after 3 seconds and displays in Preview.

screencapture -T 3 -t jpg -P delayedpic.jpg

Save Screenshots to Given Location

Sets location to ~/Desktop.

defaults write location ~/Desktop && \
killall SystemUIServer

Save Screenshots in Given Format

Sets format to png. Other options are bmp, gif, jpg, jpeg, pdf, tiff.

defaults write type -string "png"

Disable Shadow in Screenshots

defaults write disable-shadow -bool true && \
killall SystemUIServer

Set Default Screenshot Name

Date and time remain unchanged.

defaults write name "Example name" && \
killall SystemUIServer

Software Installation

Install PKG

installer -pkg /path/to/installer.pkg -target /

Software Update

Install All Available Software Updates

sudo softwareupdate -ia

Set Software Update Check Interval

Set to check daily instead of weekly.

defaults write ScheduleFrequency -int 1

Show Available Software Updates

sudo softwareupdate -l

Set Software Update Server

This should only be done for testing purposes or unmanaged clients. To use network-wide, either correctly set up DNS along with Apple SUS service and bind your clients via OpenDirectory. Alternatively, use Reposado together with correct network DNS settings to make resolution transparent. Margarita looks nice to have as well.

# Use own SUS
sudo defaults write /Library/Preferences/ CatalogURL

# Reset to Apple SUS
sudo defaults delete /Library/Preferences/ CatalogURL


Spotlight Indexing

# Disable
mdutil -i off -d /path/to/volume

# Enable (Default)
mdutil -i on /path/to/volume

Erase Spotlight Index and Rebuild

mdutil -E /path/to/volume

Search via Spotlight

mdfind -name 'searchterm'

Show Spotlight Indexed Metadata

mdls /path/to/file

System Integrity Protection

Disable System Integrity Protection

Reboot while holding Cmd + R, open the Terminal application and enter:

csrutil disable && reboot

Enable System Integrity Protection

Reboot while holding Cmd + R, open the Terminal application and enter:

csrutil enable && reboot

Date and Time

List Available Timezones

sudo systemsetup -listtimezones

Set Timezone

sudo systemsetup -settimezone Europe/Berlin

Set Clock Using Network Time

# Status
sudo systemsetup getusingnetworktime

# Enable (Default)
sudo systemsetup setusingnetworktime on

# Disable
sudo systemsetup setusingnetworktime off


Ring Terminal Bell

Rings the terminal bell (if enabled) and puts a badge on it.

tput bel

Alternative Terminals

  • iTerm2 - A better



Install the latest version and set as current users' default shell:

brew install bash && \
echo $(brew --prefix)/bin/bash | sudo tee -a /etc/shells && \
chsh -s $(brew --prefix)/bin/bash
  • Homepage - The default shell for OS X and most other Unix-based operating systems.
  • Bash-it - Community Bash framework, like Oh My Zsh for Bash.


Install the latest version and set as current users' default shell:

brew install fish && \
echo $(brew --prefix)/bin/fish | sudo tee -a /etc/shells && \
chsh -s $(brew --prefix)/bin/fish
  • Homepage - A smart and user-friendly command line shell for OS X, Linux, and the rest of the family.
  • Fisherman - A blazing fast, modern plugin manager for Fish.
  • The Fishshell Framework - Provides core infrastructure to allow you to install packages which extend or modify the look of your shell.
  • Installation & Configuration Tutorial - How to Setup Fish Shell with Fisherman, Powerline Fonts, iTerm2 and Budspencer Theme on OS X.


Install the latest version and set as current users' default shell:

brew install zsh && \
sudo sh -c 'echo $(brew --prefix)/bin/zsh >> /etc/shells' && \
chsh -s $(brew --prefix)/bin/zsh
  • Homepage - Zsh is a shell designed for interactive use, although it is also a powerful scripting language.
  • Oh My Zsh - An open source, community-driven framework for managing your Zsh configuration.
  • Prezto - A speedy Zsh framework. Enriches the command line interface environment with sane defaults, aliases, functions, auto completion, and prompt themes.
  • zgen - Another open source framework for managing your zsh configuration. Zgen will load oh-my-zsh compatible plugins and themes and has the advantage of both being faster and automatically cloning any plugins used in your configuration for you.

Terminal Fonts

  • Anonymous Pro - A family of four fixed-width fonts designed with coding in mind.
  • Codeface - A gallery and repository of monospaced fonts for developers.
  • DejaVu Sans Mono - A font family based on the Vera Fonts.
  • Hack - Hack is hand groomed and optically balanced to be your go-to code face.
  • Inconsolata - A monospace font, designed for code listings and the like.
  • Input - A flexible system of fonts designed specifically for code.
  • Meslo - Customized version of Apple's Menlo font.
  • Operator Mono - A surprisingly usable alternative take on a monospace font (commercial).
  • Powerline Fonts - Repo of patched fonts for the Powerline plugin.
  • Source Code Pro - A monospaced font family for user interfaces and coding environments.


Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.