MacOS CLI Tips
- brew
- launchctl
- smbutil
- List hardware using system_profiler
- more macOS (bash) commands
Show hidden files and folders
Use defaults:
defaults write com.apple.finder AppleShowAllFiles -bool true
Enable Check for Updates
Use defaults:
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
Prevent Sleep Mode
Use caffeinate to keep your Mac from falling asleep:
caffeinate
Copy Files & Directories
Use ditto, it preserves:
- ownership attributes and permissions
- file resource forks
- file and folder metadata
ditto ~/Desktop/FluffyBackups /Volumes/FluffyBackups/
Merge the directories:
ditto ~/Pictures/Fall2015/ /Volumes/PhotoBackup/2015/
Show system temps using CLI
Use powermetrics:
sudo powermetrics --samplers smc
On my Intel MacBook Pro:
sudo powermetrics --samplers smc
Password:
Machine model: MacBookPro16,1
SMC version: Unknown
EFI version: 2069.3.0
OS version: 24D70
Boot arguments:
Boot time: Thu Feb 20 08:26:07 2025
*** Sampled system activity (Thu Mar 13 10:16:36 2025 -0700) (5006.14ms elapsed) ***
**** SMC sensors ****
CPU Thermal level: 66
GPU Thermal level: 16
IO Thermal level: 16
Fan: 2942.43 rpm
CPU die temperature: 76.93 C
GPU die temperature: 71.00 C
CPU Plimit: 0.00
GPU Plimit (Int): 0.00
Number of prochots: 0
Networking
Use ifconfig to show interfaces:
ifconfig
Show Routes:
netstat -rn