| name | osascript-sysinfo |
| description | Read macOS system state. Use when checking battery percentage and charge state, getting OS version and hardware specs, listing startup login items, or reading macOS user defaults (NSUserDefaults / plist app preferences). |
osascript-sysinfo
System state queries via pmset, NSProcessInfo ObjC bridge, System Events, and defaults.
All scripts are pure Python — mix of subprocess shell and JXA ObjC bridge.
Scripts
Battery percentage, charging state, and time remaining (MacBook only):
uv run scripts/battery.py
OS version, hostname, CPU count, RAM, username — via NSProcessInfo ObjC bridge:
uv run scripts/system-info.py
List, add, or remove apps that launch at login via System Events:
uv run scripts/login-items.py --list
uv run scripts/login-items.py --add /Applications/Spotify.app
uv run scripts/login-items.py --remove Spotify
Read macOS user defaults by domain and optional key — --export for full domain JSON:
uv run scripts/user-defaults.py com.apple.dock
uv run scripts/user-defaults.py com.apple.finder AppleShowAllFiles
uv run scripts/user-defaults.py NSGlobalDomain --export
uv run scripts/user-defaults.py --list-domains
Key Tools / APIs
| Tool | Use case |
|---|
pmset -g batt | Battery percentage, state, time remaining |
NSProcessInfo (JXA ObjC) | OS version string, hostname, CPU count, RAM |
| System Events login items | Add/remove startup apps |
defaults + plutil CLI | Read/write NSUserDefaults (Dock, Finder, any app) |
Useful defaults Domains
com.apple.dock — Dock position, tile size, autohide
com.apple.finder — Finder view, hidden files (AppleShowAllFiles)
NSGlobalDomain — Dark mode (AppleInterfaceStyle), key repeat, scroll direction
Reference