MacOS Command Line
☰ Table of Content
Some MacOS commands and keyboard shortcuts.
Keyboard Shortcut
| Shortcut | Description |
|---|---|
| Command+, | Open preference of most app |
| Command+. or ESC | Click cancel in dialog |
| Command+Option+Left/Right | Switch tab in app |
| Command+Shift+. | Show hidden file in finder |
| Command+` | Switch window of the same app |
| Command+b | Toggle sidebar in app |
| Command+d | Click Don't Save in dialog |
| Command+h | Hide app (not minimize) |
| Command+m | Minimize app |
| Command+q | Close active app |
| Command+tab | Switch app |
| Command+w | Close active tab of an app |
| Option+ESC | TTS selected text |
Desktop Space
| Shortcut | Description |
|---|---|
| Ctrl+Up Arrow | Select space |
| Ctrl+Down Arrow | Return to desktop |
Un-minimize
| Shortcut | Description |
|---|---|
| Command+tab -> (do not release Command) -> Command+option+return | Un-minimize app |
Run Application from Command Line
Application name is case-sensitive. Use tab for auto-complete.
| |
Launch Control
List all services
1 2 3launchctl list # List services launchctl load <plist file> # Start service launchctl unload <plist file> # Stop serviceList all 3rd-party(non-Apple) services
1launchctl list|grep -v com.apple.System Service Location
/Library/LaunchDaemons//System/Library/LaunchDaemons/
Memory Usage
Result is in page number. Multiply with page size show at the top.
| |
Kernel Extension
List all kernel extension
1kextstatList all non-Apple extension
1kextstat | grep -v com.apple
Plist Content
| |
Safe Mode
Hold down Shift during boot.
Command line may not work anymore.
Enable
1 2sudo nvram boot-args="-x" sudo nvram boot-args="-x -v"Disable
1sudo nvram boot-args=""
Network Setup Command
Help
1networksetupList all network service
1networksetup -listallnetworkservicesTurn network service on/off
1 2 3networksetup -setnetworkserviceenabled <networkservice> <on off> networksetup -setnetworkserviceenabled Ethernet off networksetup -setnetworkserviceenabled Ethernet on
Change Hostname
| |
dns-sd (mdns/avahi/bonjour)
Get address of hostname
| |
Mouse Speed
Get
1defaults read -g com.apple.mouse.scalingSet
May need reboot.
1defaults write -g com.apple.mouse.scaling your_mouse_speed
Play Audio
| |
Play Text (TTS)
Check available voices and languages
| |
TTS
| |
Specify voice and language
| |
Disable Spotlight Index
Index status for a directory
| |
Disable indexing for a directory
| |
John Siu
Update: 2025-08-02