Apple's Unix desktop operating system.

Links

Useful Commands

  • caffeinate
  • mdutil
  • networksetup
  • scutil
  • serverinfo
  • sharing
  • tccutil

Show hardware info

system_profiler SPHardwareDataType

Install package from CLI

Use for most things. Otherwise:

sudo installer -pkg /Volumes/ExifTool-9.16/ExifTool-9.16.pkg -target /

See also: https://brew.sh/

Start FTP server

sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist

Check swap usage

sysctl vm.swapusage

Disable wifi disconnect when locking screen

sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources airport en1 prefs DisconnectOnLogout=NO

Show some downloaded files

This shows a list of all the quarantine checked downloads:

sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select distinct LSQuarantineDataURLString from LSQuarantineEvent'

Send Notifications from Terminal

sudo gem install terminal-notifier
terminal-notifier -message "Hello, this is my message" -title "Message Title"

Enable verbose eap logging

sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.eapolclient LogFlags -int -1

Network

  • gif0 - Generic Tunnel Interface. See man gif.
  • stf0 - Six To Four tunnel. See man stf.

Migration Assistant

Some files are not migrated using Migration Assistant. EG:

  • /etc/hosts
  • crontabs
  • /etc/apache2/httpd.conf

Remap caps-lock to escape

This remaps using a different mechanism than what the Keyboard pref pane uses, so the change will not be reflected there, so you will want to make sure to save both of these functions so you can reset when you need normal behavior.

caps_to_esc_map(){
    hidutil property --set \
    '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}'
}

caps_to_esc_unmap(){
    hidutil property --set '{"UserKeyMapping":[]}'
}