Skip to content

Disable startup chime

Settings > Sound > Un-check Play sound on startup

sudo nvram StartupMute=%01

Enable charging sound

Source

defaults write com.apple.PowerChime ChimeOnAllHardware -bool true
open /System/Library/CoreServices/PowerChime.app

Disable with:

defaults write com.apple.PowerChime ChimeOnAllHardware -bool false

Show current temperature

sudo powermetrics --samplers smc | grep -i "CPU die temperature"

Battery / power status

Current battery charge:

ioreg -rw0 -c AppleSmartBattery | grep BatteryData | grep -o -e '"StateOfCharge"=[0-9]*' | cut -d '=' -f 2

Show all values:

ioreg -rw0 -c AppleSmartBattery

HomeBrew

https://docs.brew.sh/Installation

Alternatives: - https://ports.macports.org/port/pass/

Intall

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

You may need to install (it should be installed automatically)

xcode-select --install

Disable analytics

brew analytics off

HomeBrew Maintenance

  • To list all the software/lib installed by brew brew list
  • Update an app brew update appname
  • See issues brew doctor
  • Update brew itself brew update
  • List outdated software/lib brew outdated
  • Update all the outdated software/lib brew upgrade
  • Cleanup brew cleaup

Notifications for scripts

Show notifications. Source

osascript -e 'display notification "hello world!" with title "Greeting" subtitle "More text"'

Show notification with sound.

osascript -e 'display notification "hello world!" with title "Greeting" subtitle "More text" sound name "Submarine"'

Other commands

sha256sum

shasum -a 256 file

poweroff and other with commands

Source

Shut down without showing a confirmation dialog:

osascript -e 'tell app "System Events" to shut down'

Shut down after showing a confirmation dialog:

osascript -e 'tell app "loginwindow" to «event aevtrsdn»'

Restart without showing a confirmation dialog:

osascript -e 'tell app "System Events" to restart'

Restart after showing a confirmation dialog:

osascript -e 'tell app "loginwindow" to «event aevtrrst»'

Log out without showing a confirmation dialog:

osascript -e 'tell app "System Events" to  «event aevtrlgo»'

Log out after showing a confirmation dialog:

osascript -e 'tell app "System Events" to log out'

Go to sleep (pmset):

pmset sleepnow

Go to sleep (AppleScript):

osascript -e 'tell app "System Events" to sleep'

Put displays to sleep (10.9 and later):

pmset displaysleepnow

Screenshots

Disable shadow.

defaults write com.apple.screencapture disable-shadow -bool true; killall SystemUIServer

JPEG instead of PNG.

defaults write com.apple.screencapture type jpg; killall SystemUIServer

Monitoring tools

  • https://github.com/Chris911/iStats
  • powermetrics (included)

bclm

MacOS command-line utility to limit max battery charge https://github.com/zackelia/bclm

  • Current limit bclm read
  • Set new limit bclm write 50. Minimum is 50.
  • Enable sudo bclm persist. Make sure it is always at the same level.
  • Disable sudo bclm unpersist
  • Current charge ioreg -rw0 -c AppleSmartBattery | grep BatteryData | grep -o -e '"StateOfCharge"=[0-9]*' | cut -d '=' -f 2

Links