# Osx CLI

# [![Awesome macOS Command Line](https://camo.githubusercontent.com/b344e0f75cdbf22ed64c199dff6c3c00bb8f5c22/68747470733a2f2f63646e2e7261776769742e636f6d2f6865727262697363686f66662f617765736f6d652d6d61636f732d636f6d6d616e642d6c696e652f63616238323466302f6173736574732f6c6f676f2e737667)](https://camo.githubusercontent.com/b344e0f75cdbf22ed64c199dff6c3c00bb8f5c22/68747470733a2f2f63646e2e7261776769742e636f6d2f6865727262697363686f66662f617765736f6d652d6d61636f732d636f6d6d616e642d6c696e652f63616238323466302f6173736574732f6c6f676f2e737667)

> 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](https://camo.githubusercontent.com/13c4e50d88df7178ae1882a203ed57b641674f94/68747470733a2f2f63646e2e7261776769742e636f6d2f73696e647265736f726875732f617765736f6d652f643733303566333864323966656437386661383536353265336136336531353464643865383832392f6d656469612f62616467652e737667)](https://github.com/sindresorhus/awesome) [![Build Status](https://camo.githubusercontent.com/ff082524d7bd203b635e936fb7c1b419fd1c1447/68747470733a2f2f7472617669732d63692e6f72672f6865727262697363686f66662f617765736f6d652d6d61636f732d636f6d6d616e642d6c696e652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/herrbischoff/awesome-macos-command-line)

## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#appearance)Appearance

##### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#transparency)Transparency

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#transparency-in-menu-and-windows)Transparency in Menu and Windows

<div id="bkmrk-%23-reduce-transparenc">```
<span class="pl-c"># Reduce Transparency</span>
defaults write com.apple.universalaccess reduceTransparency -bool <span class="pl-c1">true</span>

<span class="pl-c"># Restore Default Transparency</span>
defaults write com.apple.universalaccess reduceTransparency -bool <span class="pl-c1">false</span>
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#wallpaper)Wallpaper

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#set-wallpaper)Set Wallpaper

<div id="bkmrk-%23-up-to-mountain-lio">```
<span class="pl-c"># Up to Mountain Lion</span>
osascript -e <span class="pl-s"><span class="pl-pds">'</span>tell application "Finder" to set desktop picture to POSIX file "/path/to/picture.jpg"<span class="pl-pds">'</span></span>

<span class="pl-c"># Since Mavericks</span>
sqlite3 <span class="pl-k">~</span>/Library/Application<span class="pl-cce">\ </span>Support/Dock/desktoppicture.db <span class="pl-s"><span class="pl-pds">"</span>update data set value = '/path/to/picture.jpg'<span class="pl-pds">"</span></span> <span class="pl-k">&&</span> killall Dock
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#applications)Applications

### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#app-store)App Store

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#list-all-apps-downloaded-from-app-store)List All Apps Downloaded from App Store

<div id="bkmrk-%23-via-find-find-%2Fapp">```
<span class="pl-c"># Via find</span>
find /Applications -path <span class="pl-s"><span class="pl-pds">'</span>*Contents/_MASReceipt/receipt<span class="pl-pds">'</span></span> -maxdepth 4 -print <span class="pl-k">|</span><span class="pl-cce">\s</span>ed <span class="pl-s"><span class="pl-pds">'</span>s#.app/Contents/_MASReceipt/receipt#.app#g; s#/Applications/##<span class="pl-pds">'</span></span>

<span class="pl-c"># Via Spotlight</span>
mdfind kMDItemAppStoreHasReceipt=1
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-debug-menu)Show Debug Menu

Works up to Yosemite.

<div id="bkmrk-%23-enable-defaults-wr">```
<span class="pl-c"># Enable</span>
defaults write com.apple.appstore ShowDebugMenu -bool <span class="pl-c1">true</span>

<span class="pl-c"># Disable (Default)</span>
defaults write com.apple.appstore ShowDebugMenu -bool <span class="pl-c1">false</span>
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#apple-remote-desktop)Apple Remote Desktop

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#kickstart-manual-pages)Kickstart Manual Pages

<div id="bkmrk-sudo-%2Fsystem%2Flibrary">```
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -help
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#activate-and-deactivate-the-ard-agent-and-helper)Activate And Deactivate the ARD Agent and Helper

<div id="bkmrk-%23-activate-and-resta">```
<span class="pl-c"># Activate And Restart the ARD Agent and Helper</span>
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -restart -agent -console

<span class="pl-c"># Deactivate and Stop the Remote Management Service</span>
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -stop
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#enable-and-disable-remote-desktop-sharing)Enable and Disable Remote Desktop Sharing

<div id="bkmrk-%23-allow-access-for-a">```
<span class="pl-c"># Allow Access for All Users and Give All Users Full Access</span>
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -allUsers -privs -all

<span class="pl-c"># Disable ARD Agent and Remove Access Privileges for All Users</span>
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -configure -access -off
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#remove-apple-remote-desktop-settings)Remove Apple Remote Desktop Settings

<div id="bkmrk-sudo-rm--rf-%2Fvar%2Fdb%2F">```
sudo rm -rf /var/db/RemoteManagement <span class="pl-k">;</span> \
sudo defaults delete /Library/Preferences/com.apple.RemoteDesktop.plist <span class="pl-k">;</span> \
defaults delete <span class="pl-k">~</span>/Library/Preferences/com.apple.RemoteDesktop.plist <span class="pl-k">;</span> \
sudo rm -r /Library/Application<span class="pl-cce">\ </span>Support/Apple/Remote<span class="pl-cce">\ </span>Desktop/ <span class="pl-k">;</span> \
rm -r <span class="pl-k">~</span>/Library/Application<span class="pl-cce">\ </span>Support/Remote<span class="pl-cce">\ </span>Desktop/ <span class="pl-k">;</span> \
rm -r <span class="pl-k">~</span>/Library/Containers/com.apple.RemoteDesktop
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#contacts)Contacts

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#debug-mode)Debug Mode

<div id="bkmrk-%23-enable-defaults-wr-0">```
<span class="pl-c"># Enable</span>
defaults write com.apple.addressbook ABShowDebugMenu -bool <span class="pl-c1">true</span>

<span class="pl-c"># Disable (Default)</span>
defaults write com.apple.addressbook ABShowDebugMenu -bool <span class="pl-c1">false</span>
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#google)Google

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#uninstall-google-update)Uninstall Google Update

<div id="bkmrk-%7E%2Flibrary%2Fgoogle%2Fgoo">```
<span class="pl-k">~</span>/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Resources/ksinstall --nuke
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#itunes)iTunes

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#keyboard-media-keys)Keyboard Media Keys

This works up to Yosemite. System Integrity Protection was introduced in El Capitan which prevents system Launch Agents from being unloaded.

<div id="bkmrk-%23-stop-responding-to">```
<span class="pl-c"># Stop Responding to Key Presses</span>
launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist

<span class="pl-c"># Respond to Key Presses (Default)</span>
launchctl load -w /System/Library/LaunchAgents/com.apple.rcd.plist
```

</div>From El Capitan onwards, you can either disable SIP or resort to a kind of hack, which will make iTunes inaccessible to any user, effectively preventing it from starting itself or its helpers. Be aware that for all intents and purposes this will trash your iTunes installation and may conflict with OS updates down the road.

<div id="bkmrk-sudo-chmod-0000-%2Fapp">```
sudo chmod 0000 /Applications/iTunes.app
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#mail)Mail

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-attachments-as-icons)Show Attachments as Icons

<div id="bkmrk-defaults-write-com.a">```
defaults write com.apple.mail DisableInlineAttachmentViewing -bool yes
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#vacuum-mail-index)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.

<div id="bkmrk-%28%2A-speed-up-mail.app">```
<span class="pl-c">(*</span>
<span class="pl-c">Speed up Mail.app by vacuuming the Envelope Index</span>
<span class="pl-c">Code from: http://web.archive.org/web/20071008123746/http://www.hawkwings.net/2007/03/03/scripts-to-automate-the-mailapp-envelope-speed-trick/</span>
<span class="pl-c">Originally by "pmbuko" with modifications by Romulo</span>
<span class="pl-c">Updated by Brett Terpstra 2012</span>
<span class="pl-c">Updated by Mathias Törnblom 2015 to support V3 in El Capitan and still keep backwards compatibility</span>
<span class="pl-c">Updated by Andrei Miclaus 2017 to support V4 in Sierra</span>
<span class="pl-c">*)</span>

<span class="pl-k">tell</span> <span class="pl-c1">application</span> <span class="pl-s"><span class="pl-pds">"</span>Mail<span class="pl-pds">"</span></span> <span class="pl-k">to</span> quit
<span class="pl-k">set</span> <span class="pl-smi">os_version</span> <span class="pl-k">to</span> <span class="pl-c1">do shell script</span> <span class="pl-s"><span class="pl-pds">"</span>sw_vers -productVersion<span class="pl-pds">"</span></span>
<span class="pl-k">set</span> <span class="pl-smi">mail_version</span> <span class="pl-k">to</span> <span class="pl-s"><span class="pl-pds">"</span>V2<span class="pl-pds">"</span></span>
considering <span class="pl-c1">numeric strings</span>
    <span class="pl-k">if</span> <span class="pl-s"><span class="pl-pds">"</span>10.10<span class="pl-pds">"</span></span> <span class="pl-k"><=</span> os_version <span class="pl-k">then</span> <span class="pl-k">set</span> <span class="pl-smi">mail_version</span> <span class="pl-k">to</span> <span class="pl-s"><span class="pl-pds">"</span>V3<span class="pl-pds">"</span></span>
    <span class="pl-k">if</span> <span class="pl-s"><span class="pl-pds">"</span>10.12<span class="pl-pds">"</span></span> <span class="pl-k"><=</span> os_version <span class="pl-k">then</span> <span class="pl-k">set</span> <span class="pl-smi">mail_version</span> <span class="pl-k">to</span> <span class="pl-s"><span class="pl-pds">"</span>V4<span class="pl-pds">"</span></span>
    <span class="pl-k">if</span> <span class="pl-s"><span class="pl-pds">"</span>10.13<span class="pl-pds">"</span></span> <span class="pl-k"><=</span> os_version <span class="pl-k">then</span> <span class="pl-k">set</span> <span class="pl-smi">mail_version</span> <span class="pl-k">to</span> <span class="pl-s"><span class="pl-pds">"</span>V5<span class="pl-pds">"</span></span>
    <span class="pl-k">if</span> <span class="pl-s"><span class="pl-pds">"</span>10.14<span class="pl-pds">"</span></span> <span class="pl-k"><=</span> os_version <span class="pl-k">then</span> <span class="pl-k">set</span> <span class="pl-smi">mail_version</span> <span class="pl-k">to</span> <span class="pl-s"><span class="pl-pds">"</span>V6<span class="pl-pds">"</span></span>
<span class="pl-k">end</span> <span class="pl-k">considering</span>

<span class="pl-k">set</span> <span class="pl-smi">sizeBefore</span> <span class="pl-k">to</span> <span class="pl-c1">do shell script</span> <span class="pl-s"><span class="pl-pds">"</span>ls -lnah ~/Library/Mail/<span class="pl-pds">"</span></span> <span class="pl-k">&</span> mail_version <span class="pl-k">&</span> <span class="pl-s"><span class="pl-pds">"</span>/MailData | grep -E 'Envelope Index$' | awk {'print $5'}<span class="pl-pds">"</span></span>
<span class="pl-c1">do shell script</span> <span class="pl-s"><span class="pl-pds">"</span>/usr/bin/sqlite3 ~/Library/Mail/<span class="pl-pds">"</span></span> <span class="pl-k">&</span> mail_version <span class="pl-k">&</span> <span class="pl-s"><span class="pl-pds">"</span>/MailData/Envelope<span class="pl-cce">\\</span> Index vacuum<span class="pl-pds">"</span></span>

<span class="pl-k">set</span> <span class="pl-smi">sizeAfter</span> <span class="pl-k">to</span> <span class="pl-c1">do shell script</span> <span class="pl-s"><span class="pl-pds">"</span>ls -lnah ~/Library/Mail/<span class="pl-pds">"</span></span> <span class="pl-k">&</span> mail_version <span class="pl-k">&</span> <span class="pl-s"><span class="pl-pds">"</span>/MailData | grep -E 'Envelope Index$' | awk {'print $5'}<span class="pl-pds">"</span></span>

<span class="pl-c1">display dialog</span> (<span class="pl-s"><span class="pl-pds">"</span>Mail index before: <span class="pl-pds">"</span></span> <span class="pl-k">&</span> sizeBefore <span class="pl-k">&</span> <span class="pl-c1">return</span> <span class="pl-k">&</span> <span class="pl-s"><span class="pl-pds">"</span>Mail index after: <span class="pl-pds">"</span></span> <span class="pl-k">&</span> sizeAfter <span class="pl-k">&</span> <span class="pl-c1">return</span> <span class="pl-k">&</span> <span class="pl-c1">return</span> <span class="pl-k">&</span> <span class="pl-s"><span class="pl-pds">"</span>Enjoy the new speed!<span class="pl-pds">"</span></span>)

<span class="pl-k">tell</span> <span class="pl-c1">application</span> <span class="pl-s"><span class="pl-pds">"</span>Mail<span class="pl-pds">"</span></span> <span class="pl-k">to</span> <span class="pl-c1">activate</span>
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#safari)Safari

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#change-default-fonts)Change Default Fonts

<div id="bkmrk-defaults-write-com.a-0">```
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2StandardFontFamily Georgia
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DefaultFontSize 16
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2FixedFontFamily Menlo
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DefaultFixedFontSize 14
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#enable-develop-menu-and-web-inspector)Enable Develop Menu and Web Inspector

<div id="bkmrk-defaults-write-com.a-1">```
defaults write com.apple.Safari IncludeInternalDebugMenu -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
defaults write com.apple.Safari IncludeDevelopMenu -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
defaults write -g WebKitDeveloperExtras -bool <span class="pl-c1">true</span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#get-current-page-data)Get Current Page Data

Other options: `get source`, `get text`.

<div id="bkmrk-osascript--e-%27tell-a">```
osascript -e <span class="pl-s"><span class="pl-pds">'</span>tell application "Safari" to get URL of current tab of front window<span class="pl-pds">'</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#use-backspacedelete-to-go-back-a-page)Use Backspace/Delete to Go Back a Page

<div id="bkmrk-%23-enable-defaults-wr-1">```
<span class="pl-c"># Enable</span>
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool YES

<span class="pl-c"># Disable</span>
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool NO
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#sketch)Sketch

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#export-compact-svgs)Export Compact SVGs

<div id="bkmrk-defaults-write-com.b">```
defaults write com.bohemiancoding.sketch3 exportCompactSVG -bool yes
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#skim)Skim

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#turn-off-auto-reload-dialog)Turn Off Auto Reload Dialog

Removes the dialog and defaults to auto reload.

<div id="bkmrk-defaults-write--app-">```
defaults write -app Skim SKAutoReloadFileUpdate -boolean <span class="pl-c1">true</span>
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#terminal)Terminal

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#focus-follows-mouse)Focus Follows Mouse

<div id="bkmrk-%23-enable-defaults-wr-2">```
<span class="pl-c"># Enable</span>
defaults write com.apple.Terminal FocusFollowsMouse -string YES

<span class="pl-c"># Disable</span>
defaults write com.apple.Terminal FocusFollowsMouse -string NO
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#textedit)TextEdit

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#use-plain-text-mode-as-default)Use Plain Text Mode as Default

<div id="bkmrk-defaults-write-com.a-2">```
defaults write com.apple.TextEdit RichText -int 0
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#visual-studio-code)Visual Studio Code

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#fix-vscodevim-key-repeat)Fix VSCodeVim Key Repeat

<div id="bkmrk-defaults-write-com.m">```
defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool <span class="pl-c1">false</span>
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#backup)Backup

### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#time-machine)Time Machine

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#change-backup-interval)Change Backup Interval

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

<div id="bkmrk-sudo-defaults-write-">```
sudo defaults write /System/Library/LaunchDaemons/com.apple.backupd-auto StartInterval -int 1800
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#local-backups)Local Backups

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

<div id="bkmrk-%23-status-defaults-re">```
<span class="pl-c"># Status</span>
defaults <span class="pl-c1">read</span> /Library/Preferences/com.apple.TimeMachine MobileBackups

<span class="pl-c"># Enable (Default)</span>
sudo tmutil enablelocal

<span class="pl-c"># Disable</span>
sudo tmutil disablelocal
```

</div>Since High Sierra, you cannot disable local snapshots. Time Machine now always creates a local APFS snapshot and uses that snapshot as the data source to create a regular backup, rather than using the live disk as the source, as is the case with HFS formatted disks.

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#prevent-time-machine-from-prompting-to-use-new-hard-drives-as-backup-volume)Prevent Time Machine from Prompting to Use New Hard Drives as Backup Volume

<div id="bkmrk-sudo-defaults-write--0">```
sudo defaults write /Library/Preferences/com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool <span class="pl-c1">true</span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-time-machine-logs)Show Time Machine Logs

This little script will output the last 12 hours of Time Machine activity followed by live activity.

<div id="bkmrk-%23%21%2Fbin%2Fsh-filter%3D%27pr">```
<span class="pl-c">#!/bin/sh</span>

filter=<span class="pl-s"><span class="pl-pds">'</span>processImagePath contains "backupd" and subsystem beginswith "com.apple.TimeMachine"<span class="pl-pds">'</span></span>

<span class="pl-c"># show the last 12 hours</span>
start=<span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">$(</span>date -j -v-12H +<span class="pl-pds">'</span>%Y-%m-%d %H:%M:%S<span class="pl-pds">'</span><span class="pl-pds">)</span><span class="pl-pds">"</span></span>

<span class="pl-c1">echo</span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>
<span class="pl-c1">echo</span> <span class="pl-s"><span class="pl-pds">"</span>[History (from <span class="pl-smi">$start</span>)]<span class="pl-pds">"</span></span>
<span class="pl-c1">echo</span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>

log show --style syslog --info --start <span class="pl-s"><span class="pl-pds">"</span><span class="pl-smi">$start</span><span class="pl-pds">"</span></span> --predicate <span class="pl-s"><span class="pl-pds">"</span><span class="pl-smi">$filter</span><span class="pl-pds">"</span></span>

<span class="pl-c1">echo</span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>
<span class="pl-c1">echo</span> <span class="pl-s"><span class="pl-pds">"</span>[Following]<span class="pl-pds">"</span></span>
<span class="pl-c1">echo</span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>

log stream --style syslog --info --predicate <span class="pl-s"><span class="pl-pds">"</span><span class="pl-smi">$filter</span><span class="pl-pds">"</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#toggle-backup-while-on-battery)Toggle Backup While on Battery

<div id="bkmrk-%23-status-sudo-defaul">```
<span class="pl-c"># Status</span>
sudo defaults <span class="pl-c1">read</span> /Library/Preferences/com.apple.TimeMachine RequiresACPower

<span class="pl-c"># Enable (Default)</span>
sudo defaults write /Library/Preferences/com.apple.TimeMachine RequiresACPower -bool <span class="pl-c1">true</span>

<span class="pl-c"># Disable</span>
sudo defaults write /Library/Preferences/com.apple.TimeMachine RequiresACPower -bool <span class="pl-c1">false</span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#verify-backup)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.

<div id="bkmrk-sudo-tmutil-verifych">```
sudo tmutil verifychecksums /path/to/backup
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#developer)Developer

### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#vim)Vim

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#compile-sane-vim)Compile Sane Vim

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

<div id="bkmrk-brew-install-macvim-">```
brew install macvim --HEAD
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#neovim)Neovim

Install the modern Vim drop-in alternative via Homebrew.

<div id="bkmrk-brew-install-neovim">```
brew install neovim
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#xcode)Xcode

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#install-command-line-tools-without-xcode)Install Command Line Tools without Xcode

<div id="bkmrk-xcode-select---insta">```
xcode-select --install
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#remove-all-unavailable-simulators)Remove All Unavailable Simulators

<div id="bkmrk-xcrun-simctl-delete-">```
xcrun simctl delete unavailable
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#dock)Dock

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#add-a-stack-with-recent-applications)Add a Stack with Recent Applications

<div id="bkmrk-defaults-write-com.a-3">```
defaults write com.apple.dock persistent-others -array-add <span class="pl-s"><span class="pl-pds">'</span>{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }<span class="pl-pds">'</span></span> <span class="pl-k">&&</span> \
killall Dock
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#add-a-nameless-stack-folder-and-small-spacer)Add a Nameless Stack Folder and Small Spacer

<div id="bkmrk-defaults-write-com.a-4">```
defaults write com.apple.dock persistent-others -array-add <span class="pl-s"><span class="pl-pds">'</span>{ "tile-data" = {}; "tile-type"="small-spacer-tile"; }<span class="pl-pds">'</span></span> <span class="pl-k">&&</span> \
killall Dock
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#add-a-space)Add a Space

<div id="bkmrk-defaults-write-com.a-5">```
defaults write com.apple.dock persistent-apps -array-add <span class="pl-s"><span class="pl-pds">'</span>{"tile-type"="spacer-tile";}<span class="pl-pds">'</span></span> <span class="pl-k">&&</span> \
killall Dock
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#add-a-small-space)Add a Small Space

<div id="bkmrk-defaults-write-com.a-6">```
defaults write com.apple.dock persistent-apps -array-add <span class="pl-s"><span class="pl-pds">'</span>{"tile-type"="small-spacer-tile";}<span class="pl-pds">'</span></span> <span class="pl-k">&&</span> \
killall Dock
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#auto-rearrange-spaces-based-on-most-recent-use)Auto Rearrange Spaces Based on Most Recent Use

<div id="bkmrk-%23-enable-%28default%29-d">```
<span class="pl-c"># Enable (Default)</span>
defaults write com.apple.dock mru-spaces -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
killall Dock

<span class="pl-c"># Disable</span>
defaults write com.apple.dock mru-spaces -bool <span class="pl-c1">false</span> <span class="pl-k">&&</span> \
killall Dock
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#autohide)Autohide

<div id="bkmrk-%23-enable-defaults-wr-3">```
<span class="pl-c"># Enable</span>
defaults write com.apple.dock autohide -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
killall Dock

<span class="pl-c"># Disable (Default)</span>
defaults write com.apple.dock autohide -bool <span class="pl-c1">false</span> <span class="pl-k">&&</span> \
killall Dock
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#icon-bounce)Icon Bounce

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

<div id="bkmrk-%23-enable-%28default%29-d-0">```
<span class="pl-c"># Enable (Default)</span>
defaults write com.apple.dock no-bouncing -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
killall Dock

<span class="pl-c"># Disable</span>
defaults write com.apple.dock no-bouncing -bool <span class="pl-c1">false</span> <span class="pl-k">&&</span> \
killall Dock
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#lock-the-dock-size)Lock the Dock Size

<div id="bkmrk-%23-enable-defaults-wr-4">```
<span class="pl-c"># Enable</span>
defaults write com.apple.Dock size-immutable -bool yes <span class="pl-k">&&</span> \
killall Dock

<span class="pl-c"># Disable (Default)</span>
defaults write com.apple.Dock size-immutable -bool no <span class="pl-k">&&</span> \
killall Dock
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#reset-dock)Reset Dock

<div id="bkmrk-defaults-delete-com.">```
defaults delete com.apple.dock <span class="pl-k">&&</span> \
killall Dock
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#resize)Resize

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

<div id="bkmrk-defaults-write-com.a-7">```
defaults write com.apple.dock tilesize -int 0 <span class="pl-k">&&</span> \
killall Dock
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#scroll-gestures)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.

<div id="bkmrk-%23-enable-defaults-wr-5">```
<span class="pl-c"># Enable</span>
defaults write com.apple.dock scroll-to-open -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
killall Dock

<span class="pl-c"># Disable (Default)</span>
defaults write com.apple.dock scroll-to-open -bool <span class="pl-c1">false</span> <span class="pl-k">&&</span> \
killall Dock
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#set-auto-showhide-delay)Set Auto Show/Hide Delay

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

<div id="bkmrk-defaults-write-com.a-8">```
defaults write com.apple.dock autohide-time-modifier -float 0.4 <span class="pl-k">&&</span> \
defaults write com.apple.dock autohide-delay -float 0 <span class="pl-k">&&</span> \
killall Dock
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-hidden-app-icons)Show Hidden App Icons

<div id="bkmrk-%23-enable-defaults-wr-6">```
<span class="pl-c"># Enable</span>
defaults write com.apple.dock showhidden -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
killall Dock

<span class="pl-c"># Disable (Default)</span>
defaults write com.apple.dock showhidden -bool <span class="pl-c1">false</span> <span class="pl-k">&&</span> \
killall Dock
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-only-active-applications)Show Only Active Applications

<div id="bkmrk-%23-enable-defaults-wr-7">```
<span class="pl-c"># Enable</span>
defaults write com.apple.dock static-only -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
killall Dock

<span class="pl-c"># Disable (Default)</span>
defaults write com.apple.dock static-only -bool <span class="pl-c1">false</span> <span class="pl-k">&&</span> \
killall Dock
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#single-app-mode)Single App Mode

When clicking an application icon in the Dock, the respective windows will come to the front, but all other application windows will be hidden.

<div id="bkmrk-%23-enable-defaults-wr-8">```
<span class="pl-c"># Enable</span>
defaults write com.apple.dock single-app -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
killall Dock

<span class="pl-c"># Disable (Default)</span>
defaults write com.apple.dock single-app -bool <span class="pl-c1">false</span> <span class="pl-k">&&</span> \
killall Dock
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#documents)Documents

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#convert-file-to-html)Convert File to HTML

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

<div id="bkmrk-textutil--convert-ht">```
textutil -convert html file.ext
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#files-disks-and-volumes)Files, Disks and Volumes

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#create-an-empty-file)Create an Empty File

Creates an empty 10 gigabyte test file.

<div id="bkmrk-mkfile-10g-%2Fpath%2Fto%2F">```
mkfile 10g /path/to/file
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#disable-sudden-motion-sensor)Disable Sudden Motion Sensor

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

<div id="bkmrk-sudo-pmset--a-sms-0">```
sudo pmset -a sms 0
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#eject-all-mountable-volumes)Eject All Mountable Volumes

The only reliable way to do this is by sending an AppleScript command to Finder.

<div id="bkmrk-osascript--e-%27tell-a-0">```
osascript -e <span class="pl-s"><span class="pl-pds">'</span>tell application "Finder" to eject (every disk whose ejectable is true)<span class="pl-pds">'</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#repair-file-permissions)Repair File Permissions

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

<div id="bkmrk-sudo-diskutil-repair">```
sudo diskutil repairPermissions /
```

</div>> 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](https://support.apple.com/en-us/HT201560))

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#set-boot-volume)Set Boot Volume

<div id="bkmrk-%23-up-to-yosemite-ble">```
<span class="pl-c"># Up to Yosemite</span>
bless --mount <span class="pl-s"><span class="pl-pds">"</span>/path/to/mounted/volume<span class="pl-pds">"</span></span> --setBoot

<span class="pl-c"># From El Capitan</span>
sudo systemsetup -setstartupdisk /System/Library/CoreServices
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-all-attached-disks-and-partitions)Show All Attached Disks and Partitions

<div id="bkmrk-diskutil-list">```
diskutil list
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#view-file-system-usage)View File System Usage

A continuous stream of file system access info.

<div id="bkmrk-sudo-fs_usage">```
sudo fs_usage
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#apfs)APFS

Available since High Sierra. There is no central utility and usage is inconsistent as most functionality is rolled into `tmutil`.

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#convert-volume-from-hfs-to-apfs)Convert Volume from HFS+ to APFS

<div id="bkmrk-%2Fsystem%2Flibrary%2Ffile">```
/System/Library/Filesystems/apfs.fs/Contents/Resources/hfs_convert /path/to/file/system
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#create-new-apfs-filesystem)Create New APFS Filesystem

<div id="bkmrk-%2Fsystem%2Flibrary%2Ffile-0">```
/System/Library/Filesystems/apfs.fs/Contents/Resources/newfs_apfs /path/to/device
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#create-snapshot)Create Snapshot

<div id="bkmrk-tmutil-localsnapshot">```
tmutil localsnapshot
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#delete-snapshot)Delete Snapshot

<div id="bkmrk-tmutil-deletelocalsn">```
tmutil deletelocalsnapshots com.apple.TimeMachine.2018-01-26-044042
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#list-snapshots)List Snapshots

<div id="bkmrk-tmutil-listlocalsnap">```
tmutil listlocalsnapshots /
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#mount-snapshot)Mount Snapshot

Snapshots are read-only.

<div id="bkmrk-mkdir-%7E%2Fmnt-%2Fsystem%2F">```
mkdir <span class="pl-k">~</span>/mnt
/System/Library/Filesystems/apfs.fs/Contents/Resources/mount_apfs -s com.apple.TimeMachine.2018-01-26-044042 / <span class="pl-k">~</span>/mnt
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#disk-images)Disk Images

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#create-disk-image-from-folder-contents)Create Disk Image From Folder Contents

<div id="bkmrk-hdiutil-create--voln">```
hdiutil create -volname <span class="pl-s"><span class="pl-pds">"</span>Volume Name<span class="pl-pds">"</span></span> -srcfolder /path/to/folder -ov diskimage.dmg
```

</div>If you'd like to encrypt the disk image:

<div id="bkmrk-hdiutil-create--encr">```
hdiutil create -encryption -stdinpass -volname <span class="pl-s"><span class="pl-pds">"</span>Volume Name<span class="pl-pds">"</span></span> -srcfolder /path/to/folder -ov encrypted.dmg
```

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

<div id="bkmrk-echo--n-yourpassword">```
<span class="pl-c1">echo</span> -n YourPassword <span class="pl-k">|</span> hdiutil create -encryption -stdinpass -volname <span class="pl-s"><span class="pl-pds">"</span>Volume Name<span class="pl-pds">"</span></span> -srcfolder /path/to/folder -ov encrypted.dmg
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#burn-disk-images-to-dvd)Burn Disk Images to DVD

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

<div id="bkmrk-hdiutil-burn-%2Fpath%2Ft">```
hdiutil burn /path/to/image_file
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#disable-disk-image-verification)Disable Disk Image Verification

<div id="bkmrk-defaults-write-com.a-9">```
defaults write com.apple.frameworks.diskimages skip-verify -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool <span class="pl-c1">true</span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#make-volume-os-x-bootable)Make Volume OS X Bootable

<div id="bkmrk-bless---folder-%22%2Fpat">```
bless --folder <span class="pl-s"><span class="pl-pds">"</span>/path/to/mounted/volume/System/Library/CoreServices<span class="pl-pds">"</span></span> --bootinfo --bootefi
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#mount-disk-image)Mount Disk Image

<div id="bkmrk-hdiutil-attach-%2Fpath">```
hdiutil attach /path/to/diskimage.dmg
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#unmount-disk-image)Unmount Disk Image

<div id="bkmrk-hdiutil-detach-%2Fdev%2F">```
hdiutil detach /dev/disk2s1
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#write-disk-image-to-volume)Write Disk Image to Volume

Like the Disk Utility "Restore" function.

<div id="bkmrk-sudo-asr--restore--n">```
sudo asr -restore -noverify -source /path/to/diskimage.dmg -target /Volumes/VolumeToRestoreTo
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#finder)Finder

### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#desktop)Desktop

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-external-media)Show External Media

External HDs, thumb drives, etc.

<div id="bkmrk-%23-enable-defaults-wr-9">```
<span class="pl-c"># Enable</span>
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
killall Finder

<span class="pl-c"># Disable (Default)</span>
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool <span class="pl-c1">false</span> <span class="pl-k">&&</span> \
killall Finder
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-internal-media)Show Internal Media

Built-in HDs or SSDs.

<div id="bkmrk-%23-enable-defaults-wr-10">```
<span class="pl-c"># Enable</span>
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
killall Finder

<span class="pl-c"># Disable (Default)</span>
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool <span class="pl-c1">false</span> <span class="pl-k">&&</span> \
killall Finder
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-removable-media)Show Removable Media

CDs, DVDs, iPods, etc.

<div id="bkmrk-%23-enable-defaults-wr-11">```
<span class="pl-c"># Enable</span>
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
killall Finder

<span class="pl-c"># Disable (Default)</span>
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool <span class="pl-c1">false</span> <span class="pl-k">&&</span> \
killall Finder
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-network-volumes)Show Network Volumes

AFP, SMB, NFS, WebDAV, etc.

<div id="bkmrk-%23-enable-defaults-wr-12">```
<span class="pl-c"># Enable</span>
defaults write com.apple.finder ShowMountedServersOnDesktop -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
killall Finder

<span class="pl-c"># Disable (Default)</span>
defaults write com.apple.finder ShowMountedServersOnDesktop -bool <span class="pl-c1">false</span> <span class="pl-k">&&</span> \
killall Finder
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#files-and-folders)Files and Folders

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#clear-all-acls)Clear All ACLs

<div id="bkmrk-sudo-chmod--rn-%2Fpath">```
sudo chmod -RN /path/to/folder
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#hide-folder-in-finder)Hide Folder in Finder

<div id="bkmrk-chflags-hidden-%2Fpath">```
chflags hidden /path/to/folder/
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-all-file-extensions)Show All File Extensions

<div id="bkmrk-defaults-write--g-ap">```
defaults write -g AppleShowAllExtensions -bool <span class="pl-c1">true</span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-hidden-files)Show Hidden Files

<div id="bkmrk-%23-show-all-defaults-">```
<span class="pl-c"># Show All</span>
defaults write com.apple.finder AppleShowAllFiles <span class="pl-c1">true</span>

<span class="pl-c"># Restore Default File Visibility</span>
defaults write com.apple.finder AppleShowAllFiles <span class="pl-c1">false</span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#remove-protected-flag)Remove Protected Flag

<div id="bkmrk-sudo-chflags--r-nouc">```
sudo chflags -R nouchg /path/to/file/or/folder
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-full-path-in-finder-title)Show Full Path in Finder Title

<div id="bkmrk-defaults-write-com.a-10">```
defaults write com.apple.finder _FXShowPosixPathInTitle -bool <span class="pl-c1">true</span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#unhide-user-library-folder)Unhide User Library Folder

<div id="bkmrk-chflags-nohidden-%7E%2Fl">```
chflags nohidden <span class="pl-k">~</span>/Library
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#increase-number-of-recent-places)Increase Number of Recent Places

<div id="bkmrk-defaults-write--g-ns">```
defaults write -g NSNavRecentPlacesLimit -int 10 <span class="pl-k">&&</span> \
killall Finder
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#layout)Layout

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-quit-finder-menu-item)Show "Quit Finder" Menu Item

Makes possible to see Finder menu item "Quit Finder" with default shortcut <kbd>Cmd</kbd> + <kbd>Q</kbd>

<div id="bkmrk-%23-enable-defaults-wr-13">```
<span class="pl-c"># Enable</span>
defaults write com.apple.finder QuitMenuItem -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
killall Finder

<span class="pl-c"># Disable (Default)</span>
defaults write com.apple.finder QuitMenuItem -bool <span class="pl-c1">false</span> <span class="pl-k">&&</span> \
killall Finder
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#smooth-scrolling)Smooth Scrolling

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

<div id="bkmrk-%23-disable-defaults-w">```
<span class="pl-c"># Disable</span>
defaults write -g NSScrollAnimationEnabled -bool <span class="pl-c1">false</span>

<span class="pl-c"># Enable (Default)</span>
defaults write -g NSScrollAnimationEnabled -bool <span class="pl-c1">true</span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#rubberband-scrolling)Rubberband Scrolling

<div id="bkmrk-%23-disable-defaults-w-0">```
<span class="pl-c"># Disable</span>
defaults write -g NSScrollViewRubberbanding -bool <span class="pl-c1">false</span>

<span class="pl-c"># Enable (Default)</span>
defaults write -g NSScrollViewRubberbanding -bool <span class="pl-c1">true</span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#expand-save-panel-by-default)Expand Save Panel by Default

<div id="bkmrk-defaults-write--g-ns-0">```
defaults write -g NSNavPanelExpandedStateForSaveMode -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
defaults write -g NSNavPanelExpandedStateForSaveMode2 -bool <span class="pl-c1">true</span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#desktop-icon-visibility)Desktop Icon Visibility

<div id="bkmrk-%23-hide-icons-default">```
<span class="pl-c"># Hide Icons</span>
defaults write com.apple.finder CreateDesktop -bool <span class="pl-c1">false</span> <span class="pl-k">&&</span> \
killall Finder

<span class="pl-c"># Show Icons (Default)</span>
defaults write com.apple.finder CreateDesktop -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
killall Finder
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#path-bar)Path Bar

<div id="bkmrk-%23-show-defaults-writ">```
<span class="pl-c"># Show</span>
defaults write com.apple.finder ShowPathbar -bool <span class="pl-c1">true</span>

<span class="pl-c"># Hide (Default)</span>
defaults write com.apple.finder ShowPathbar -bool <span class="pl-c1">false</span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#scrollbar-visibility)Scrollbar Visibility

Possible values: `WhenScrolling`, `Automatic` and `Always`.

<div id="bkmrk-defaults-write--g-ap-0">```
defaults write -g AppleShowScrollBars -string <span class="pl-s"><span class="pl-pds">"</span>Always<span class="pl-pds">"</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#status-bar)Status Bar

<div id="bkmrk-%23-show-defaults-writ-0">```
<span class="pl-c"># Show</span>
defaults write com.apple.finder ShowStatusBar -bool <span class="pl-c1">true</span>

<span class="pl-c"># Hide (Default)</span>
defaults write com.apple.finder ShowStatusBar -bool <span class="pl-c1">false</span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#save-to-disk-by-default)Save to Disk by Default

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

<div id="bkmrk-defaults-write--g-ns-1">```
defaults write -g NSDocumentSaveNewDocumentsToCloud -bool <span class="pl-c1">false</span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#set-current-folder-as-default-search-scope)Set Current Folder as Default Search Scope

<div id="bkmrk-defaults-write-com.a-11">```
defaults write com.apple.finder FXDefaultSearchScope -string <span class="pl-s"><span class="pl-pds">"</span>SCcf<span class="pl-pds">"</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#set-default-finder-location-to-home-folder)Set Default Finder Location to Home Folder

<div id="bkmrk-defaults-write-com.a-12">```
defaults write com.apple.finder NewWindowTarget -string <span class="pl-s"><span class="pl-pds">"</span>PfLo<span class="pl-pds">"</span></span> <span class="pl-k">&&</span> \
defaults write com.apple.finder NewWindowTargetPath -string <span class="pl-s"><span class="pl-pds">"</span>file://<span class="pl-smi">${HOME}</span><span class="pl-pds">"</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#set-sidebar-icon-size)Set Sidebar Icon Size

Sets size to 'medium'.

<div id="bkmrk-defaults-write--g-ns-2">```
defaults write -g NSTableViewDefaultSizeMode -int 2
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#metadata-files)Metadata Files

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#disable-creation-of-metadata-files-on-network-volumes)Disable Creation of Metadata Files on Network Volumes

Avoids creation of `.DS_Store` and AppleDouble files.

<div id="bkmrk-defaults-write-com.a-13">```
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool <span class="pl-c1">true</span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#disable-creation-of-metadata-files-on-usb-volumes)Disable Creation of Metadata Files on USB Volumes

Avoids creation of `.DS_Store` and AppleDouble files.

<div id="bkmrk-defaults-write-com.a-14">```
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool <span class="pl-c1">true</span>
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#opening-things)Opening Things

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#change-working-directory-to-finder-path)Change Working Directory to Finder Path

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

<div id="bkmrk-cd-%22%24%28osascript--e-%27">```
<span class="pl-c1">cd</span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">$(</span>osascript -e <span class="pl-pds">'</span>tell app "Finder" to POSIX path of (insertion location as alias)<span class="pl-pds">'</span><span class="pl-pds">)</span><span class="pl-pds">"</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#open-url)Open URL

<div id="bkmrk-open-https%3A%2F%2Fgithub.">```
open https://github.com
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#open-file)Open File

<div id="bkmrk-open-readme.md">```
open README.md
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#open-applications)Open Applications

You can open applications using `-a`.

<div id="bkmrk-open--a-%22google-chro">```
open -a <span class="pl-s"><span class="pl-pds">"</span>Google Chrome<span class="pl-pds">"</span></span> https://github.com
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#open-folder)Open Folder

<div id="bkmrk-open-%2Fpath%2Fto%2Ffolder">```
open /path/to/folder/
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#open-current-folder)Open Current Folder

<div id="bkmrk-open-.">```
open <span class="pl-c1">.</span>
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#fonts)Fonts

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#clear-font-cache-for-current-user)Clear Font Cache for Current User

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

<div id="bkmrk-atsutil-databases--r">```
atsutil databases -removeUser <span class="pl-k">&&</span> \
atsutil server -shutdown <span class="pl-k">&&</span> \
atsutil server -ping
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#get-sf-mono-fonts)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.

<div id="bkmrk-cp--v-%2Fapplications%2F">```
cp -v /Applications/Xcode-beta.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/Fonts/SFMono-<span class="pl-k">*</span> <span class="pl-k">~</span>/Library/Fonts
```

</div>From Sierra onward, they are included in Terminal.app.

<div id="bkmrk-cp--v-%2Fapplications%2F-0">```
cp -v /Applications/Utilities/Terminal.app/Contents/Resources/Fonts/SFMono-<span class="pl-k">*</span> <span class="pl-k">~</span>/Library/Fonts
```

</div>Starting in Catalina, the Utilities apps (including Terminal.app) are now found in the `/System` folder.

<div id="bkmrk-cp--v-%2Fsystem%2Fapplic">```
cp -v /System/Applications/Utilities/Terminal.app/Contents/Resources/Fonts/SFMono-<span class="pl-k">*</span> <span class="pl-k">~</span>/Library/Fonts
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#functions)Functions

Please see [this file](https://github.com/herrbischoff/awesome-macos-command-line/blob/master/functions.md).

## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#hardware)Hardware

### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#bluetooth)Bluetooth

<div id="bkmrk-%23-status-defaults-re-0">```
<span class="pl-c"># Status</span>
defaults <span class="pl-c1">read</span> /Library/Preferences/com.apple.Bluetooth ControllerPowerState

<span class="pl-c"># Enable (Default)</span>
sudo defaults write /Library/Preferences/com.apple.Bluetooth ControllerPowerState -int 1

<span class="pl-c"># Disable</span>
sudo defaults write /Library/Preferences/com.apple.Bluetooth ControllerPowerState -int 0 <span class="pl-k">&&</span> \
sudo killall -HUP blued
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#harddisks)Harddisks

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#force-enable-trim)Force Enable Trim

Enable Trim for non-Apple SSDs. This command is available since Yosemite.

<div id="bkmrk-forcetrim">```
forcetrim
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#hardware-information)Hardware Information

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#list-all-hardware-ports)List All Hardware Ports

<div id="bkmrk-networksetup--listal">```
networksetup -listallhardwareports
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#remaining-battery-percentage)Remaining Battery Percentage

<div id="bkmrk-pmset--g-batt-%7C-egre">```
pmset -g batt <span class="pl-k">|</span> egrep <span class="pl-s"><span class="pl-pds">"</span>([0-9]+\%).*<span class="pl-pds">"</span></span> -o --colour=auto <span class="pl-k">|</span> cut -f1 -d<span class="pl-s"><span class="pl-pds">'</span>;<span class="pl-pds">'</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#remaining-battery-time)Remaining Battery Time

<div id="bkmrk-pmset--g-batt-%7C-egre-0">```
pmset -g batt <span class="pl-k">|</span> egrep <span class="pl-s"><span class="pl-pds">"</span>([0-9]+\%).*<span class="pl-pds">"</span></span> -o --colour=auto <span class="pl-k">|</span> cut -f3 -d<span class="pl-s"><span class="pl-pds">'</span>;<span class="pl-pds">'</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-connected-devices-udid)Show Connected Device's UDID

<div id="bkmrk-system_profiler-spus">```
system_profiler SPUSBDataType <span class="pl-k">|</span> sed -n -e <span class="pl-s"><span class="pl-pds">'</span>/iPad/,/Serial/p<span class="pl-pds">'</span></span> -e <span class="pl-s"><span class="pl-pds">'</span>/iPhone/,/Serial/p<span class="pl-pds">'</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-current-screen-resolution)Show Current Screen Resolution

<div id="bkmrk-system_profiler-spdi">```
system_profiler SPDisplaysDataType <span class="pl-k">|</span> grep Resolution
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-cpu-brand-string)Show CPU Brand String

<div id="bkmrk-sysctl--n-machdep.cp">```
sysctl -n machdep.cpu.brand_string
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#infrared-receiver)Infrared Receiver

<div id="bkmrk-%23-status-defaults-re-1">```
<span class="pl-c"># Status</span>
defaults <span class="pl-c1">read</span> /Library/Preferences/com.apple.driver.AppleIRController DeviceEnabled

<span class="pl-c"># Enable (Default)</span>
defaults write /Library/Preferences/com.apple.driver.AppleIRController DeviceEnabled -int 1

<span class="pl-c"># Disable</span>
defaults write /Library/Preferences/com.apple.driver.AppleIRController DeviceEnabled -int 0
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#power-management)Power Management

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#prevent-system-sleep)Prevent System Sleep

Prevent sleep for 1 hour:

<div id="bkmrk-caffeinate--u--t-360">```
caffeinate -u -t 3600
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-all-power-management-settings)Show All Power Management Settings

<div id="bkmrk-sudo-pmset--g">```
sudo pmset -g
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#put-display-to-sleep-after-15-minutes-of-inactivity)Put Display to Sleep after 15 Minutes of Inactivity

<div id="bkmrk-sudo-pmset-displaysl">```
sudo pmset displaysleep 15
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#put-computer-to-sleep-after-30-minutes-of-inactivity)Put Computer to Sleep after 30 Minutes of Inactivity

<div id="bkmrk-sudo-pmset-sleep-30">```
sudo pmset sleep 30
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#check-system-sleep-idle-time)Check System Sleep Idle Time

<div id="bkmrk-sudo-systemsetup--ge">```
sudo systemsetup -getcomputersleep
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#set-system-sleep-idle-time-to-60-minutes)Set System Sleep Idle Time to 60 Minutes

<div id="bkmrk-sudo-systemsetup--se">```
sudo systemsetup -setcomputersleep 60
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#turn-off-system-sleep-completely)Turn Off System Sleep Completely

<div id="bkmrk-sudo-systemsetup--se-0">```
sudo systemsetup -setcomputersleep Never
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#automatic-restart-on-system-freeze)Automatic Restart on System Freeze

<div id="bkmrk-sudo-systemsetup--se-1">```
sudo systemsetup -setrestartfreeze on
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#chime-when-charging)Chime When Charging

Play iOS charging sound when MagSafe is connected.

<div id="bkmrk-%23-enable-defaults-wr-14">```
<span class="pl-c"># Enable</span>
defaults write com.apple.PowerChime ChimeOnAllHardware -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
open /System/Library/CoreServices/PowerChime.app

<span class="pl-c"># Disable (Default)</span>
defaults write com.apple.PowerChime ChimeOnAllHardware -bool <span class="pl-c1">false</span> <span class="pl-k">&&</span> \
killall PowerChime
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#input-devices)Input Devices

### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#keyboard)Keyboard

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#auto-correct)Auto-Correct

<div id="bkmrk-%23-disable-defaults-w-1">```
<span class="pl-c"># Disable</span>
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool <span class="pl-c1">false</span>

<span class="pl-c"># Enable (Default)</span>
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool <span class="pl-c1">true</span>

<span class="pl-c"># Show Status</span>
defaults <span class="pl-c1">read</span> -g NSAutomaticSpellingCorrectionEnabled
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#full-keyboard-access)Full Keyboard Access

Enable Tab in modal dialogs.

<div id="bkmrk-%23-text-boxes-and-lis">```
<span class="pl-c"># Text boxes and lists only (Default)</span>
defaults write NSGlobalDomain AppleKeyboardUIMode -int 0

<span class="pl-c"># All controls</span>
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#key-repeat)Key Repeat

Disable the default "press and hold" behavior.

<div id="bkmrk-%23-enable-key-repeat-">```
<span class="pl-c"># Enable Key Repeat</span>
defaults write -g ApplePressAndHoldEnabled -bool <span class="pl-c1">false</span>

<span class="pl-c"># Disable Key Repeat</span>
defaults write -g ApplePressAndHoldEnabled -bool <span class="pl-c1">true</span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#key-repeat-rate)Key Repeat Rate

Sets a very fast repeat rate, adjust to taste.

<div id="bkmrk-defaults-write--g-ke">```
defaults write -g KeyRepeat -int 0.02
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#launchpad)Launchpad

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#reset-launchpad-layout)Reset Launchpad Layout

You need to restart `Dock` because Launchpad is tied to it.

<div id="bkmrk-%23-up-to-yosemite-rm-">```
<span class="pl-c"># Up to Yosemite</span>
rm <span class="pl-k">~</span>/Library/Application<span class="pl-cce">\ </span>Support/Dock/<span class="pl-k">*</span>.db <span class="pl-k">&&</span> \
killall Dock

<span class="pl-c"># From El Capitan</span>
defaults write com.apple.dock ResetLaunchPad -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
killall Dock
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#media)Media

### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#audio)Audio

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#convert-audio-file-to-iphone-ringtone)Convert Audio File to iPhone Ringtone

<div id="bkmrk-afconvert-input.mp3-">```
afconvert input.mp3 ringtone.m4r -f m4af
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#create-audiobook-from-text)Create Audiobook From Text

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

<div id="bkmrk-say--v-alex--f-file.">```
say -v Alex -f file.txt -o <span class="pl-s"><span class="pl-pds">"</span>output.m4a<span class="pl-pds">"</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#disable-sound-effects-on-boot)Disable Sound Effects on Boot

<div id="bkmrk-sudo-nvram-systemaud">```
sudo nvram SystemAudioVolume=<span class="pl-s"><span class="pl-pds">"</span> <span class="pl-pds">"</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#mute-audio-output)Mute Audio Output

<div id="bkmrk-osascript--e-%27set-vo">```
osascript -e <span class="pl-s"><span class="pl-pds">'</span>set volume output muted true<span class="pl-pds">'</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#set-audio-volume)Set Audio Volume

<div id="bkmrk-osascript--e-%27set-vo-0">```
osascript -e <span class="pl-s"><span class="pl-pds">'</span>set volume 4<span class="pl-pds">'</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#play-audio-file)Play Audio File

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

<div id="bkmrk-afplay--q-1-filename">```
afplay -q 1 filename.mp3
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#speak-text-with-system-default-voice)Speak Text with System Default Voice

<div id="bkmrk-say-%27all-your-base-a">```
say <span class="pl-s"><span class="pl-pds">'</span>All your base are belong to us!<span class="pl-pds">'</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#startup-chime)Startup Chime

Older Macs:

<div id="bkmrk-%23-enable-%28default%29-s">```
<span class="pl-c"># Enable (Default)</span>
sudo nvram BootAudio=%01

<span class="pl-c"># Disable</span>
sudo nvram BootAudio=%00
```

</div>From 2016 models onwards:

<div id="bkmrk-%23-enable-sudo-nvram-">```
<span class="pl-c"># Enable</span>
sudo nvram StartupMute=%00

<span class="pl-c"># Disable (Default)</span>
sudo nvram StartupMute=%01
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#video)Video

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#auto-play-videos-in-quicktime-player)Auto-Play Videos in QuickTime Player

<div id="bkmrk-defaults-write-com.a-15">```
defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen 1
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#networking)Networking

### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#bonjour)Bonjour

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#bonjour-service)Bonjour Service

<div id="bkmrk-%23-disable-sudo-defau">```
<span class="pl-c"># Disable</span>
sudo defaults write /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist ProgramArguments -array-add <span class="pl-s"><span class="pl-pds">"</span>-NoMulticastAdvertisements<span class="pl-pds">"</span></span>

<span class="pl-c"># Enable (Default)</span>
sudo defaults write /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist ProgramArguments -array <span class="pl-s"><span class="pl-pds">"</span>/usr/sbin/mDNSResponder<span class="pl-pds">"</span></span> <span class="pl-s"><span class="pl-pds">"</span>-launchd<span class="pl-pds">"</span></span>
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#dhcp)DHCP

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#renew-dhcp-lease)Renew DHCP Lease

<div id="bkmrk-sudo-ipconfig-set-en">```
sudo ipconfig <span class="pl-c1">set</span> en0 DHCP
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-dhcp-info)Show DHCP Info

<div id="bkmrk-ipconfig-getpacket-e">```
ipconfig getpacket en0
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#dns)DNS

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#clear-dns-cache)Clear DNS Cache

<div id="bkmrk-sudo-dscacheutil--fl">```
sudo dscacheutil -flushcache <span class="pl-k">&&</span> \
sudo killall -HUP mDNSResponder
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#hostname)Hostname

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#set-computer-namehost-name)Set Computer Name/Host Name

<div id="bkmrk-sudo-scutil---set-co">```
sudo scutil --set ComputerName <span class="pl-s"><span class="pl-pds">"</span>newhostname<span class="pl-pds">"</span></span> <span class="pl-k">&&</span> \
sudo scutil --set HostName <span class="pl-s"><span class="pl-pds">"</span>newhostname<span class="pl-pds">"</span></span> <span class="pl-k">&&</span> \
sudo scutil --set LocalHostName <span class="pl-s"><span class="pl-pds">"</span>newhostname<span class="pl-pds">"</span></span> <span class="pl-k">&&</span> \
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string <span class="pl-s"><span class="pl-pds">"</span>newhostname<span class="pl-pds">"</span></span>
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#network-preferences)Network Preferences

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#network-locations)Network Locations

Switch between network locations created in the Network preference pane.

<div id="bkmrk-%23-status-scselect-%23-">```
<span class="pl-c"># Status</span>
scselect

<span class="pl-c"># Switch Network Location</span>
scselect LocationNameFromStatus
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#set-static-ip-address)Set Static IP Address

<div id="bkmrk-networksetup--setman">```
networksetup -setmanual <span class="pl-s"><span class="pl-pds">"</span>Ethernet<span class="pl-pds">"</span></span> 192.168.2.100 255.255.255.0 192.168.2.1
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#networking-tools)Networking Tools

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#ping-a-host-to-see-whether-its-available)Ping a Host to See Whether It’s Available

<div id="bkmrk-ping--o-github.com">```
ping -o github.com
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#troubleshoot-routing-problems)Troubleshoot Routing Problems

<div id="bkmrk-traceroute-github.co">```
traceroute github.com
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#ssh)SSH

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#permanently-add-private-key-passphrase-to-ssh-agent)Permanently Add Private Key Passphrase to SSH Agent

> Prior to macOS Sierra, ssh would present a dialog asking for your passphrase and would offer the option to store it into the keychain. This UI was deprecated some time ago and has been removed.
> 
> Instead, a new UseKeychain option was introduced in macOS Sierra allowing users to specify whether they would like for the passphrase to be stored in the keychain. This option was enabled by default on macOS Sierra, which caused all passphrases to be stored in the keychain.
> 
> This was not the intended default behavior, so this has been changed in macOS 10.12.2. ([Source](https://developer.apple.com/library/archive/technotes/tn2449/_index.html))

<div id="bkmrk-ssh-add--k-%2Fpath%2Fto%2F">```
ssh-add -K /path/to/private_key
```

</div>Then add to `~/.ssh/config`:

<div id="bkmrk-host-server.example.">```
Host server.example.com
    IdentityFile /path/to/private_key
    UseKeychain yes
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#remote-login)Remote Login

<div id="bkmrk-%23-enable-remote-logi">```
<span class="pl-c"># Enable remote login</span>
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist

<span class="pl-c"># Disable remote login</span>
sudo launchctl unload -w /System/Library/LaunchDaemons/ssh.plist
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#tcpip)TCP/IP

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-application-using-a-certain-port)Show Application Using a Certain Port

This outputs all applications currently using port 80.

<div id="bkmrk-sudo-lsof--i-%3A80">```
sudo lsof -i :80
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-external-ip-address)Show External IP Address

Works if your ISP doesn't replace DNS requests (which it shouldn't).

<div id="bkmrk-dig-%2Bshort-myip.open">```
dig +short myip.opendns.com @resolver1.opendns.com
```

</div>Alternative that works on all networks.

<div id="bkmrk-curl--s-https%3A%2F%2Fapi.">```
curl -s https://api.ipify.org <span class="pl-k">&&</span> <span class="pl-c1">echo</span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-network-interface-information)Show Network Interface Information

Undocumented flag of the `scutil` command.

<div id="bkmrk-scutil---nwi">```
scutil --nwi
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#tftp)TFTP

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#start-native-tftp-daemon)Start Native TFTP Daemon

Files will be served from `/private/tftpboot`.

<div id="bkmrk-sudo-launchctl-load-">```
sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist <span class="pl-k">&&</span> \
sudo launchctl start com.apple.tftpd
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#wi-fi)Wi-Fi

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#join-a-wi-fi-network)Join a Wi-Fi Network

<div id="bkmrk-networksetup--setair">```
networksetup -setairportnetwork en0 WIFI_SSID WIFI_PASSWORD
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#scan-available-access-points)Scan Available Access Points

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

<div id="bkmrk-sudo-ln--s-%2Fsystem%2Fl">```
sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport
```

</div>Run a wireless scan:

<div id="bkmrk-airport--s">```
airport -s
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-current-ssid)Show Current SSID

<div id="bkmrk-%2Fsystem%2Flibrary%2Fpriv">```
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I <span class="pl-k">|</span> awk <span class="pl-s"><span class="pl-pds">'</span>/ SSID/ {print substr($0, index($0, $2))}<span class="pl-pds">'</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-local-ip-address)Show Local IP Address

<div id="bkmrk-ipconfig-getifaddr-e">```
ipconfig getifaddr en0
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-wi-fi-connection-history)Show Wi-Fi Connection History

<div id="bkmrk-defaults-read-%2Flibra">```
defaults <span class="pl-c1">read</span> /Library/Preferences/SystemConfiguration/com.apple.airport.preferences <span class="pl-k">|</span> grep LastConnected -A 7
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-wi-fi-network-passwords)Show Wi-Fi Network Passwords

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

<div id="bkmrk-security-find-generi">```
security find-generic-password -D <span class="pl-s"><span class="pl-pds">"</span>AirPort network password<span class="pl-pds">"</span></span> -a <span class="pl-s"><span class="pl-pds">"</span>SSID<span class="pl-pds">"</span></span> -gw
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#turn-on-wi-fi-adapter)Turn on Wi-Fi Adapter

<div id="bkmrk-networksetup--setair-0">```
networksetup -setairportpower en0 on
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#package-managers)Package Managers

- [Fink](http://www.finkproject.org/) - The full world of Unix Open Source software for Darwin. A little outdated.
- [Homebrew](https://brew.sh/) - The missing package manager for OS X. The most popular choice.
- [MacPorts](https://www.macports.org/) - Compile, install and upgrade either command-line, X11 or Aqua based open-source software. Very clean, it's what I use.

### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#homebrew)Homebrew

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#full-uninstall)Full Uninstall

<div id="bkmrk-ruby--e-%22%24%28curl--fss">```
ruby -e <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">$(</span>curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall<span class="pl-pds">)</span><span class="pl-pds">"</span></span>
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#printing)Printing

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#clear-print-queue)Clear Print Queue

<div id="bkmrk-cancel--a--">```
cancel -a -
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#expand-print-panel-by-default)Expand Print Panel by Default

<div id="bkmrk-defaults-write--g-pm">```
defaults write -g PMPrintingExpandedStateForPrint -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
defaults write -g PMPrintingExpandedStateForPrint2 -bool <span class="pl-c1">true</span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#quit-printer-app-after-print-jobs-complete)Quit Printer App After Print Jobs Complete

<div id="bkmrk-defaults-write-com.a-16">```
defaults write com.apple.print.PrintingPrefs <span class="pl-s"><span class="pl-pds">"</span>Quit When Finished<span class="pl-pds">"</span></span> -bool <span class="pl-c1">true</span>
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#security)Security

### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#application-firewall)Application Firewall

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#firewall-service)Firewall Service

<div id="bkmrk-%23-show-status-sudo-%2F">```
<span class="pl-c"># Show Status</span>
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate

<span class="pl-c"># Enable</span>
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on

<span class="pl-c"># Disable (Default)</span>
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#add-application-to-firewall)Add Application to Firewall

<div id="bkmrk-sudo-%2Fusr%2Flibexec%2Fap">```
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /path/to/file
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#gatekeeper)Gatekeeper

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#add-gatekeeper-exception)Add Gatekeeper Exception

<div id="bkmrk-spctl---add-%2Fpath%2Fto">```
spctl --add /path/to/Application.app
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#remove-gatekeeper-exception)Remove Gatekeeper Exception

<div id="bkmrk-spctl---remove-%2Fpath">```
spctl --remove /path/to/Application.app
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#manage-gatekeeper)Manage Gatekeeper

Especially helpful with the annoying Catalina system popup blocking execution of non-signed apps.

<div id="bkmrk-%23-status-spctl---sta">```
<span class="pl-c"># Status</span>
spctl --status

<span class="pl-c"># Enable (Default)</span>
sudo spctl --master-enable

<span class="pl-c"># Disable</span>
sudo spctl --master-disable
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#passwords)Passwords

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#generate-secure-password-and-copy-to-clipboard)Generate Secure Password and Copy to Clipboard

<div id="bkmrk-lc_all%3Dc-tr--dc-%22%5B%3Aa">```
LC_ALL=C tr -dc <span class="pl-s"><span class="pl-pds">"</span>[:alnum:]<span class="pl-pds">"</span></span> <span class="pl-k"><</span> /dev/urandom <span class="pl-k">|</span> head -c 20 <span class="pl-k">|</span> pbcopy
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#physical-access)Physical Access

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#launch-screen-saver)Launch Screen Saver

<div id="bkmrk-%23-up-to-sierra-open-">```
<span class="pl-c"># Up to Sierra</span>
open /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app

<span class="pl-c"># From High Sierra</span>
/System/Library/CoreServices/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#lock-screen)Lock Screen

<div id="bkmrk-%2Fsystem%2Flibrary%2Fcore">```
/System/Library/CoreServices/Menu<span class="pl-cce">\ </span>Extras/User.menu/Contents/Resources/CGSession -suspend
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#screensaver-immediate-lock)Screensaver Immediate Lock

<div id="bkmrk-%23-status-defaults-re-2">```
<span class="pl-c"># Status</span>
defaults <span class="pl-c1">read</span> com.apple.screensaver askForPasswordDelay

<span class="pl-c"># Enable (Default)</span>
defaults write com.apple.screensaver askForPasswordDelay -int 0

<span class="pl-c"># Disable (Integer = lock delay in seconds)</span>
defaults write com.apple.screensaver askForPasswordDelay -int 10
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#screensaver-password)Screensaver Password

<div id="bkmrk-%23-status-defaults-re-3">```
<span class="pl-c"># Status</span>
defaults <span class="pl-c1">read</span> com.apple.screensaver askForPassword

<span class="pl-c"># Enable</span>
defaults write com.apple.screensaver askForPassword -int 1

<span class="pl-c"># Disable (Default)</span>
defaults write com.apple.screensaver askForPassword -int 0
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#wiping-data)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](https://support.apple.com/en-us/HT201949) 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.

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#securely-remove-file)Securely Remove File

<div id="bkmrk-srm-%2Fpath%2Fto%2Ffile">```
srm /path/to/file
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#securely-remove-folder)Securely Remove Folder

<div id="bkmrk-srm--r-%2Fpath%2Fto%2Ffold">```
srm -r /path/to/folder/
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#securely-remove-path-force)Securely Remove Path (Force)

<div id="bkmrk-srm--rf-%2Fpath%2Fto%2Fcom">```
srm -rf /path/to/complete/destruction
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#search)Search

### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#find)Find

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#recursively-delete-ds_store-files)Recursively Delete .DS\_Store Files

<div id="bkmrk-find-.--type-f--name">```
find <span class="pl-c1">.</span> -type f -name <span class="pl-s"><span class="pl-pds">'</span>*.DS_Store<span class="pl-pds">'</span></span> -ls -delete
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#locate)Locate

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#build-locate-database)Build Locate Database

<div id="bkmrk-sudo-launchctl-load--0">```
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#search-via-locate)Search via Locate

The `-i` modifier makes the search case insensitive.

<div id="bkmrk-locate--i-%2A.jpg">```
locate -i <span class="pl-k">*</span>.jpg
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#system)System

### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#airdrop)AirDrop

<div id="bkmrk-%23-enable-airdrop-ove">```
<span class="pl-c"># Enable AirDrop over Ethernet and on Unsupported Macs</span>
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool <span class="pl-c1">true</span>

<span class="pl-c"># Enable (Default)</span>
defaults remove com.apple.NetworkBrowser DisableAirDrop

<span class="pl-c"># Disable</span>
defaults write com.apple.NetworkBrowser DisableAirDrop -bool YES
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#applescript)AppleScript

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#execute-applescript)Execute AppleScript

<div id="bkmrk-osascript-%2Fpath%2Fto%2Fs">```
osascript /path/to/script.scpt
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#basics)Basics

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#compare-two-folders)Compare Two Folders

<div id="bkmrk-diff--qr-%2Fpath%2Fto%2Ffo">```
diff -qr /path/to/folder1 /path/to/folder2
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#copy-large-file-with-progress)Copy Large File with Progress

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

<div id="bkmrk-file%3D%2Fpath%2Fto%2Ffile.i">```
FILE=/path/to/file.iso pv -s <span class="pl-s"><span class="pl-pds">$(</span>du -h <span class="pl-smi">$FILE</span> <span class="pl-k">|</span> awk <span class="pl-pds">'</span>/.*/ {print $1}<span class="pl-pds">'</span><span class="pl-pds">)</span></span> <span class="pl-smi">$FILE</span> <span class="pl-k">|</span> sudo dd of=/dev/rdisk2 bs=1m
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#restore-sane-shell)Restore Sane Shell

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

<div id="bkmrk-stty-sane">```
stty sane
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#restart)Restart

<div id="bkmrk-sudo-reboot">```
sudo reboot
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#shutdown)Shutdown

<div id="bkmrk-sudo-poweroff">```
sudo poweroff
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-build-number-of-os)Show Build Number of OS

<div id="bkmrk-sw_vers">```
sw_vers
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#uptime)Uptime

How long since your last restart.

<div id="bkmrk-uptime-0">```
uptime
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#clipboard)Clipboard

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#copy-data-to-clipboard)Copy data to Clipboard

<div id="bkmrk-cat-whatever.txt-%7C-p">```
cat whatever.txt <span class="pl-k">|</span> pbcopy
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#convert-clipboard-to-plain-text)Convert Clipboard to Plain Text

<div id="bkmrk-pbpaste-%7C-textutil--">```
pbpaste <span class="pl-k">|</span> textutil -convert txt -stdin -stdout -encoding 30 <span class="pl-k">|</span> pbcopy
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#convert-tabs-to-spaces-for-clipboard-content)Convert Tabs to Spaces for Clipboard Content

<div id="bkmrk-pbpaste-%7C-expand-%7C-p">```
pbpaste <span class="pl-k">|</span> expand <span class="pl-k">|</span> pbcopy
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#copy-data-from-clipboard)Copy data from Clipboard

<div id="bkmrk-pbpaste-%3E-whatever.t">```
pbpaste <span class="pl-k">></span> whatever.txt
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#sort-and-strip-duplicate-lines-from-clipboard-content)Sort and Strip Duplicate Lines from Clipboard Content

<div id="bkmrk-pbpaste-%7C-sort-%7C-uni">```
pbpaste <span class="pl-k">|</span> sort <span class="pl-k">|</span> uniq <span class="pl-k">|</span> pbcopy
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#filevault)FileVault

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#automatically-unlock-filevault-on-restart)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.

<div id="bkmrk-sudo-fdesetup-authre">```
sudo fdesetup authrestart
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#filevault-service)FileVault Service

<div id="bkmrk-%23-status-sudo-fdeset">```
<span class="pl-c"># Status</span>
sudo fdesetup status

<span class="pl-c"># Enable</span>
sudo fdesetup <span class="pl-c1">enable</span>

<span class="pl-c"># Disable (Default)</span>
sudo fdesetup disable
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#informationreports)Information/Reports

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#generate-advanced-system-and-performance-report)Generate Advanced System and Performance Report

<div id="bkmrk-sudo-sysdiagnose--f-">```
sudo sysdiagnose -f <span class="pl-k">~</span>/Desktop/
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#install-os)Install OS

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#create-bootable-installer)Create Bootable Installer

<div id="bkmrk-%23-mojave-sudo-%2Fappli">```
<span class="pl-c"># Mojave</span>
sudo /Applications/Install<span class="pl-cce">\ </span>macOS<span class="pl-cce">\ </span>Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/USB --nointeraction --downloadassets

<span class="pl-c"># High Sierra</span>
sudo /Applications/Install<span class="pl-cce">\ </span>macOS<span class="pl-cce">\ </span>High<span class="pl-cce">\ </span>Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/USB --applicationpath /Applications/Install<span class="pl-cce">\ </span>macOS<span class="pl-cce">\ </span>High<span class="pl-cce">\ </span>Sierra.app

<span class="pl-c"># Sierra</span>
sudo /Applications/Install<span class="pl-cce">\ </span>macOS<span class="pl-cce">\ </span>Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/USB --applicationpath /Applications/Install<span class="pl-cce">\ </span>macOS<span class="pl-cce">\ </span>Sierra.app

<span class="pl-c"># El Capitan</span>
sudo /Applications/Install<span class="pl-cce">\ </span>OS<span class="pl-cce">\ </span>X<span class="pl-cce">\ </span>El<span class="pl-cce">\ </span>Capitan.app/Contents/Resources/createinstallmedia --volume /Volumes/USB --applicationpath /Applications/Install<span class="pl-cce">\ </span>OS<span class="pl-cce">\ </span>X<span class="pl-cce">\ </span>El<span class="pl-cce">\ </span>Capitan.app

<span class="pl-c"># Yosemite</span>
sudo /Applications/Install<span class="pl-cce">\ </span>OS<span class="pl-cce">\ </span>X<span class="pl-cce">\ </span>Yosemite.app/Contents/Resources/createinstallmedia --volume /Volumes/USB --applicationpath /Applications/Install<span class="pl-cce">\ </span>OS<span class="pl-cce">\ </span>X<span class="pl-cce">\ </span>Yosemite.app
```

</div>- For confirmation before erasing the drive, remove `–-nointeraction` from the command.
- The optional `–-downloadassets` flag is new in Mojave. It downloads assets which may be required during installation, like updates.
- The `–-applicationpath` flag is deprecated since Mojave and will throw an error if used.

### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#kernel-extensions)Kernel Extensions

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#display-status-of-loaded-kernel-extensions)Display Status of Loaded Kernel Extensions

<div id="bkmrk-sudo-kextstat--l">```
sudo kextstat -l
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#load-kernel-extension)Load Kernel Extension

<div id="bkmrk-sudo-kextload--b-com">```
sudo kextload -b com.apple.driver.ExampleBundle
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#unload-kernel-extensions)Unload Kernel Extensions

<div id="bkmrk-sudo-kextunload--b-c">```
sudo kextunload -b com.apple.driver.ExampleBundle
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#launchagents)LaunchAgents

Please see [this file](https://github.com/herrbischoff/awesome-macos-command-line/blob/master/launchagents.md).

### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#launchservices)LaunchServices

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#rebuild-launchservices-database)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](https://github.com/herrbischoff/awesome-macos-command-line#build-locate-database).

<div id="bkmrk-sudo-%24%28locate-lsregi">```
sudo <span class="pl-s"><span class="pl-pds">$(</span>locate lsregister<span class="pl-pds">)</span></span> -kill -seed -r
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#login-window)Login Window

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#set-login-window-text)Set Login Window Text

<div id="bkmrk-sudo-defaults-write--1">```
sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText <span class="pl-s"><span class="pl-pds">"</span>Your text<span class="pl-pds">"</span></span>
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#memory-management)Memory Management

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#purge-memory-cache)Purge memory cache

<div id="bkmrk-sudo-purge">```
sudo purge
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-memory-statistics)Show Memory Statistics

<div id="bkmrk-%23-one-time-vm_stat-%23">```
<span class="pl-c"># One time</span>
vm_stat

<span class="pl-c"># Table of data, repeat 10 times total, 1 second wait between each poll</span>
vm_stat -c 10 1
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#notification-center)Notification Center

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#notification-center-service)Notification Center Service

<div id="bkmrk-%23-disable-launchctl-">```
<span class="pl-c"># Disable</span>
launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist <span class="pl-k">&&</span> \
killall -9 NotificationCenter

<span class="pl-c"># Enable (Default)</span>
launchctl load -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#quicklook)QuickLook

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#preview-via-quicklook)Preview via QuickLook

<div id="bkmrk-qlmanage--p-%2Fpath%2Fto">```
qlmanage -p /path/to/file
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#remote-apple-events)Remote Apple Events

<div id="bkmrk-%23-status-sudo-system">```
<span class="pl-c"># Status</span>
sudo systemsetup -getremoteappleevents

<span class="pl-c"># Enable</span>
sudo systemsetup -setremoteappleevents on

<span class="pl-c"># Disable (Default)</span>
sudo systemsetup -setremoteappleevents off
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#root-user)Root User

<div id="bkmrk-%23-enable-dsenableroo">```
<span class="pl-c"># Enable</span>
dsenableroot

<span class="pl-c"># Disable</span>
dsenableroot -d
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#safe-mode-boot)Safe Mode Boot

<div id="bkmrk-%23-status-nvram-boot-">```
<span class="pl-c"># Status</span>
nvram boot-args

<span class="pl-c"># Enable</span>
sudo nvram boot-args=<span class="pl-s"><span class="pl-pds">"</span>-x<span class="pl-pds">"</span></span>

<span class="pl-c"># Disable</span>
sudo nvram boot-args=<span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#save-dialogs)Save Dialogs

Significantly improve the now rather slow animation in save dialogs.

<div id="bkmrk-defaults-write-nsglo">```
defaults write NSGlobalDomain NSWindowResizeTime .001
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#screenshots)Screenshots

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#take-delayed-screenshot)Take Delayed Screenshot

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

<div id="bkmrk-screencapture--t-3--">```
screencapture -T 3 -t jpg -P delayedpic.jpg
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#save-screenshots-to-given-location)Save Screenshots to Given Location

Sets location to `~/Desktop`.

<div id="bkmrk-defaults-write-com.a-17">```
defaults write com.apple.screencapture location <span class="pl-k">~</span>/Desktop <span class="pl-k">&&</span> \
killall SystemUIServer
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#save-screenshots-in-given-format)Save Screenshots in Given Format

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

<div id="bkmrk-defaults-write-com.a-18">```
defaults write com.apple.screencapture <span class="pl-c1">type</span> -string <span class="pl-s"><span class="pl-pds">"</span>png<span class="pl-pds">"</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#disable-shadow-in-screenshots)Disable Shadow in Screenshots

<div id="bkmrk-defaults-write-com.a-19">```
defaults write com.apple.screencapture disable-shadow -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
killall SystemUIServer
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#set-default-screenshot-name)Set Default Screenshot Name

Date and time remain unchanged.

<div id="bkmrk-defaults-write-com.a-20">```
defaults write com.apple.screencapture name <span class="pl-s"><span class="pl-pds">"</span>Example name<span class="pl-pds">"</span></span> <span class="pl-k">&&</span> \
killall SystemUIServer
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#software-installation)Software Installation

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#install-pkg)Install PKG

<div id="bkmrk-installer--pkg-%2Fpath">```
installer -pkg /path/to/installer.pkg -target /
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#sidecar)Sidecar

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#use-on-incompatible-macs)Use on Incompatible Macs

This may or may not work, depending on the age of the machine.

<div id="bkmrk-%23-enable-defaults-wr-15">```
<span class="pl-c"># Enable</span>
defaults write com.apple.sidecar.display AllowAllDevices -bool <span class="pl-c1">true</span> <span class="pl-k">&&</span> \
defaults write com.apple.sidecar.display hasShownPref -bool <span class="pl-c1">true</span>

<span class="pl-c"># Disable (Default)</span>
defaults delete com.apple.sidecar.display
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#software-update)Software Update

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#ignore-specific-software-update)Ignore Specific Software Update

The identifier can be found via `softwareupdate --list`. In the example below, being on Mojave, will ignore all update prompts to Catalina, since the latter removes 32-bit support.

<div id="bkmrk-sudo-%2Fusr%2Fsbin%2Fsoftw">```
sudo /usr/sbin/softwareupdate --ignore <span class="pl-s"><span class="pl-pds">"</span>macOS Catalina<span class="pl-pds">"</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#install-all-available-software-updates)Install All Available Software Updates

<div id="bkmrk-sudo-softwareupdate-">```
sudo softwareupdate -ia
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#set-software-update-check-interval)Set Software Update Check Interval

Set to check daily instead of weekly.

<div id="bkmrk-defaults-write-com.a-21">```
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-available-software-updates)Show Available Software Updates

<div id="bkmrk-sudo-softwareupdate--0">```
sudo softwareupdate --list
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#set-software-update-server)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](http://krypted.com/mac-security/using-the-software-update-service-on-mountain-lion-server/) and bind your clients via OpenDirectory. Alternatively, use [Reposado](https://github.com/wdas/reposado) together with correct network DNS settings to make resolution transparent. [Margarita](https://github.com/jessepeterson/margarita) looks nice to have as well.

<div id="bkmrk-%23-use-own-sus-sudo-d">```
<span class="pl-c"># Use own SUS</span>
sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL http://su.example.com:8088/index.sucatalog

<span class="pl-c"># Reset to Apple SUS</span>
sudo defaults delete /Library/Preferences/com.apple.SoftwareUpdate CatalogURL
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#software-version)Software Version

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-system-software-version)Show System Software Version

<div id="bkmrk-sw_vers--productvers">```
sw_vers -productVersion
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#spotlight)Spotlight

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#spotlight-indexing)Spotlight Indexing

<div id="bkmrk-%23-disable-mdutil--i-">```
<span class="pl-c"># Disable</span>
mdutil -i off -d /path/to/volume

<span class="pl-c"># Enable (Default)</span>
mdutil -i on /path/to/volume
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#erase-spotlight-index-and-rebuild)Erase Spotlight Index and Rebuild

<div id="bkmrk-mdutil--e-%2Fpath%2Fto%2Fv">```
mdutil -E /path/to/volume
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#search-via-spotlight)Search via Spotlight

<div id="bkmrk-mdfind--name-%27search">```
mdfind -name <span class="pl-s"><span class="pl-pds">'</span>searchterm<span class="pl-pds">'</span></span>
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#show-spotlight-indexed-metadata)Show Spotlight Indexed Metadata

<div id="bkmrk-mdls-%2Fpath%2Fto%2Ffile">```
mdls /path/to/file
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#system-integrity-protection)System Integrity Protection

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#disable-system-integrity-protection)Disable System Integrity Protection

Reboot while holding <kbd>Cmd</kbd> + <kbd>R</kbd>, open the Terminal application and enter:

<div id="bkmrk-csrutil-disable-%26%26-r">```
csrutil disable <span class="pl-k">&&</span> reboot
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#enable-system-integrity-protection)Enable System Integrity Protection

Reboot while holding <kbd>Cmd</kbd> + <kbd>R</kbd>, open the Terminal application and enter:

<div id="bkmrk-csrutil-enable-%26%26-re">```
csrutil <span class="pl-c1">enable</span> <span class="pl-k">&&</span> reboot
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#date-and-time)Date and Time

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#list-available-timezones)List Available Timezones

<div id="bkmrk-sudo-systemsetup--li">```
sudo systemsetup -listtimezones
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#set-timezone)Set Timezone

<div id="bkmrk-sudo-systemsetup--se-2">```
sudo systemsetup -settimezone Europe/Berlin
```

</div>#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#set-clock-using-network-time)Set Clock Using Network Time

<div id="bkmrk-%23-status-sudo-system-0">```
<span class="pl-c"># Status</span>
sudo systemsetup getusingnetworktime

<span class="pl-c"># Enable (Default)</span>
sudo systemsetup setusingnetworktime on

<span class="pl-c"># Disable</span>
sudo systemsetup setusingnetworktime off
```

</div>## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#terminal-1)Terminal

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#ring-terminal-bell)Ring Terminal Bell

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

<div id="bkmrk-tput-bel">```
tput bel
```

</div>### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#alternative-terminals)Alternative Terminals

- [Alacritty](https://github.com/jwilm/alacritty) - Cross-platform, GPU-accelerated terminal emulator.
- [iTerm2](https://iterm2.com/) - A better Terminal.app.
- [kitty](https://sw.kovidgoyal.net/kitty/) - Modern, GPU-accelerated terminal emulator.

### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#shells)Shells

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#bash)Bash

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

<div id="bkmrk-brew-install-bash-%26%26">```
brew install bash <span class="pl-k">&&</span> \
<span class="pl-c1">echo</span> <span class="pl-s"><span class="pl-pds">$(</span>brew --prefix<span class="pl-pds">)</span></span>/bin/bash <span class="pl-k">|</span> sudo tee -a /etc/shells <span class="pl-k">&&</span> \
chsh -s <span class="pl-s"><span class="pl-pds">$(</span>brew --prefix<span class="pl-pds">)</span></span>/bin/bash
```

</div>- [Homepage](https://www.gnu.org/software/bash/) - The default shell for OS X and most other Unix-based operating systems.
- [Bash-it](https://github.com/Bash-it/bash-it) - Community Bash framework, like Oh My Zsh for Bash.

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#fish)fish

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

<div id="bkmrk-brew-install-fish-%26%26">```
brew install fish <span class="pl-k">&&</span> \
<span class="pl-c1">echo</span> <span class="pl-s"><span class="pl-pds">$(</span>brew --prefix<span class="pl-pds">)</span></span>/bin/fish <span class="pl-k">|</span> sudo tee -a /etc/shells <span class="pl-k">&&</span> \
chsh -s <span class="pl-s"><span class="pl-pds">$(</span>brew --prefix<span class="pl-pds">)</span></span>/bin/fish
```

</div>- [Homepage](http://fishshell.com/) - A smart and user-friendly command line shell for OS X, Linux, and the rest of the family.
- [The Fishshell Framework](https://github.com/oh-my-fish/oh-my-fish) - Provides core infrastructure to allow you to install packages which extend or modify the look of your shell.
- [Installation &amp; Configuration Tutorial](https://github.com/ellerbrock/fish-shell-setup-osx) - How to Setup Fish Shell with Fisherman, Powerline Fonts, iTerm2 and Budspencer Theme on OS X.

#### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#zsh)Zsh

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

<div id="bkmrk-brew-install-zsh-%26%26-">```
brew install zsh <span class="pl-k">&&</span> \
sudo sh -c <span class="pl-s"><span class="pl-pds">'</span>echo $(brew --prefix)/bin/zsh >> /etc/shells<span class="pl-pds">'</span></span> <span class="pl-k">&&</span> \
chsh -s <span class="pl-s"><span class="pl-pds">$(</span>brew --prefix<span class="pl-pds">)</span></span>/bin/zsh
```

</div>- [Homepage](http://www.zsh.org/) - Zsh is a shell designed for interactive use, although it is also a powerful scripting language.
- [Oh My Zsh](http://ohmyz.sh/) - An open source, community-driven framework for managing your Zsh configuration.
- [Prezto](https://github.com/sorin-ionescu/prezto) - A speedy Zsh framework. Enriches the command line interface environment with sane defaults, aliases, functions, auto completion, and prompt themes.
- [zgen](https://github.com/tarjoilija/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.

### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#terminal-fonts)Terminal Fonts

- [Anonymous Pro](http://www.marksimonson.com/fonts/view/anonymous-pro) - A family of four fixed-width fonts designed with coding in mind.
- [Codeface](https://github.com/chrissimpkins/codeface) - A gallery and repository of monospaced fonts for developers.
- [DejaVu Sans Mono](https://dejavu-fonts.github.io/) - A font family based on the Vera Fonts.
- [Hack](http://sourcefoundry.org/hack/) - Hack is hand groomed and optically balanced to be your go-to code face.
- [Inconsolata](http://levien.com/type/myfonts/inconsolata.html) - A monospace font, designed for code listings and the like.
- [Input](http://input.fontbureau.com/) - A flexible system of fonts designed specifically for code.
- [Meslo](https://github.com/andreberg/Meslo-Font) - Customized version of Apple's Menlo font.
- [Operator Mono](https://www.typography.com/fonts/operator/overview/) - A surprisingly usable alternative take on a monospace font (commercial).
- [Powerline Fonts](https://github.com/powerline/fonts) - Repo of patched fonts for the Powerline plugin.
- [Source Code Pro](https://adobe-fonts.github.io/source-code-pro/) - A monospaced font family for user interfaces and coding environments.

## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#glossary)Glossary

### [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#mac-os-x-os-x-and-macos-version-information)Mac OS X, OS X, and macOS Version Information

<table id="bkmrk-version-codename-rel"><thead><tr><th>Version</th><th>Codename</th><th>Release Date</th><th>Most Recent Version</th></tr></thead><tbody><tr><td>Rhapsody Developer Release</td><td>Grail1Z4 / Titan1U</td><td>August 31, 1997</td><td>DR2 (May 14, 1998)</td></tr><tr><td>Mac OS X Server 1.0</td><td>Hera</td><td>March 16, 1999</td><td>1.2v3 (October 27, 2000)</td></tr><tr><td>Mac OS X Developer Preview</td><td>n/a</td><td>March 16, 1999</td><td>DP4 (April 5, 2000)</td></tr><tr><td>Mac OS X Public Beta</td><td>Kodiak</td><td>September 13, 2000</td><td>n/a</td></tr><tr><td>Mac OS X 10.0</td><td>Cheetah</td><td>March 24, 2001</td><td>10.0.4 (June 22, 2001)</td></tr><tr><td>Mac OS X 10.1</td><td>Puma</td><td>September 25, 2001</td><td>10.1.5 (June 6, 2002)</td></tr><tr><td>Mac OS X 10.2</td><td>Jaguar</td><td>August 24, 2002</td><td>10.2.8 (October 3, 2003)</td></tr><tr><td>Mac OS X 10.3</td><td>Panther</td><td>October 24, 2003</td><td>10.3.9 (April 15, 2005)</td></tr><tr><td>Mac OS X 10.4</td><td>Tiger</td><td>April 29, 2005</td><td>10.4.11 (November 14, 2007)</td></tr><tr><td>Mac OS X 10.5</td><td>Leopard</td><td>October 26, 2007</td><td>10.5.8 (August 5, 2009)</td></tr><tr><td>Mac OS X 10.6</td><td>Snow Leopard</td><td>August 28, 2009</td><td>10.6.8 v1.1 (July 25, 2011)</td></tr><tr><td>Mac OS X 10.7</td><td>Lion</td><td>July 20, 2011</td><td>10.7.5 (September 19, 2012)</td></tr><tr><td>OS X 10.8</td><td>Mountain Lion</td><td>July 25, 2012</td><td>10.8.5 (12F45) (October 3, 2013)</td></tr><tr><td>OS X 10.9</td><td>Mavericks</td><td>October 22, 2013</td><td>10.9.5 (13F1112) (September 18, 2014)</td></tr><tr><td>OS X 10.10</td><td>Yosemite</td><td>October 16, 2014</td><td>10.10.5 (14F27) (August 13, 2015)</td></tr><tr><td>OS X 10.11</td><td>El Capitan</td><td>September 30, 2015</td><td>10.11.6 (15G31) (July 18, 2016)</td></tr><tr><td>macOS 10.12</td><td>Sierra</td><td>September 20, 2016</td><td>10.12.6 (16G29) (July 19, 2017)</td></tr><tr><td>macOS 10.13</td><td>High Sierra</td><td>September 25, 2017</td><td>10.13.6 (17G65) (July 9, 2018)</td></tr><tr><td>macOS 10.14</td><td>Mojave</td><td>September 24, 2018</td><td>10.14.6 (18G3020) (January 28, 2020)</td></tr><tr><td>macOS 10.15</td><td>Catalina</td><td>October 7, 2019</td><td>10.15.3 (19D76) (January 28, 2020)</td></tr></tbody></table>

## [<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>](https://github.com/herrbischoff/awesome-macos-command-line#license)License

[![Creative Commons License](https://camo.githubusercontent.com/68525ec5f8acf359e826761fa50e9262da143eb5/68747470733a2f2f6c6963656e7365627574746f6e732e6e65742f6c2f62792d73612f342e302f38387833312e706e67)](https://creativecommons.org/licenses/by-sa/4.0/)  
This work is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/).