macOS Automation
This setup includes macOS-specific automation and preferences.
Defaults / Settings
The raw scripts live here:
They are applied via hooks:
home/.chezmoiscripts/run_onchange_after_05-osx.core.sh.tmplhome/.chezmoiscripts/run_onchange_after_05-osx.extra.sh.tmpl
These scripts can change system behavior. Expect that some changes require a logout/restart to fully take effect.
If you want to disable this category entirely, the most direct approach is to remove or comment out the relevant hook scripts in home/.chezmoiscripts/.
Core Apply Workflow
- Review local dotfiles changes:
chezmoi diff
- Apply:
chezmoi apply
- Reboot/log out if settings did not visually update yet.
You can also run .osx scripts directly while debugging:
bash home/.osx.core
bash home/.osx.extra
Hammerspoon
Key pieces:
- Window management hotkeys:
home/dot_hammerspoon/readonly_window.lua - Grid-mouse (keyboard mouse):
home/dot_hammerspoon/readonly_gridmouse.lua(currently not enabled ininit.lua)
In init.lua, Hyper is configured as ctrl+alt+cmd.
This setup pulls the EmmyLua.spoon via externals:
Workflow:
- Edit modules under
home/dot_hammerspoon/. - Reload Hammerspoon config from the app menu.
- Verify configured keybindings in
init.luaand module files.
Karabiner
Workflow:
- Edit
karabiner.json. - Import/reload through Karabiner-Elements.
- Validate by testing the modified key mapping directly.
Alfred
Note: this directory is currently ignored by chezmoi via home/.chezmoiignore. It is kept in the repo as a reference/backup rather than being automatically installed.
Custom App Icons
- Mapping:
home/app_icons/readonly_icon_mapping.yaml - Script:
home/exact_bin/executable_,apply-app-icons.tmpl - Hook:
home/.chezmoiscripts/run_onchange_after_05-apply-app-icons.sh.tmpl
Note: home/app_icons/ is ignored by chezmoi via home/.chezmoiignore. The script reads icon assets from the repo source directory.
Scheduled jobs (crontab)
A user crontab is installed (replacing the existing one) from a repo-managed file:
- Crontab contents:
home/crontab - Hook:
home/.chezmoiscripts/run_onchange_after_05-install-crontab.sh.tmpl
The hook is a thin wrapper that runs crontab "$CHEZMOI_SOURCE_DIR/crontab"; the hash trigger means it only re-installs when the file changes. The shipped entry kills the macOS git fsmonitor--daemon every 5 minutes, working around the daemon's tendency to wedge or pin CPU on large repos.
*/5 * * * * /usr/bin/pkill -f ".../git-core/git fsmonitor--daemon" >/dev/null 2>&1
Edit home/crontab and chezmoi apply to change the schedule, or run crontab -l to inspect the installed table. To opt out, remove the hook script and clear the entry with crontab -e.
Verification
Check a few high-signal defaults:
defaults read -g KeyRepeat
defaults read com.apple.screencapture location
defaults read net.freemacsoft.AppCleaner SUAutomaticallyUpdate
Check icon command wiring:
command -v ,apply-app-icons
Troubleshooting
defaultschanges did not apply:- restart affected apps (
Finder,Dock,SystemUIServer) or reboot.
- restart affected apps (
,apply-app-iconsfails:- verify
fileiconandyqare installed. - verify
home/app_icons/readonly_icon_mapping.yamland asset files exist.
- verify
- Hook runs but nothing changed:
- confirm the script hash-trigger input actually changed.