Helpful Mac CLI Settings
Mac tries to be the os where everything just works, but there are actually a lot of really powerful and useful settings that do not appear anywhere in the UI. This is a growing list of the hidden options that I use.
Show hidden files
Open finder to a folder
Press Command + Shift + . (period key)
Avoid creating .DS_Store files on network or usb drives
If a Windows machine access a shared storage device, you have probably ran across these extra files in every folder from a Mac that just opens the directory.
defaults write com.apple.desktopservies DSDontWriteNetworkStores -bool true defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
Spotlight is a nice tool when it works, but if you catch your machine CPU and fans maxing out, there is a good chance it is from mdsync.
sudo mdutil -a -i off mdutil -s #Print indexing status
Or, if you have a drive/folder you want spotlight to ignore, add the file
While PNGs are lossless and nice, they often are 5x as large as their JPG conterparts
defaults write com.apple.screencapture "type" -string "jpg"
defaults write com.apple.screencapture "type" -string "png"
Hide Desktop Icons
If you have a messy desktop but want to illusion of order when you share your screen, turn off your desktop icons. (the files are all still accessible)
defaults write com.apple.finder "CreateDesktop" -bool "false" && killall Finder
Restart without entering filevault password
Sometimes you need to do a remote restart of a system, and you don’t want it stuck at the power on password screen, this allows you to reboot and fully startup.
sudo fdesetup authrestart
Check out more at https://macos-defaults.com/