Skip to content
mono0xPublic

About

dotfiles

Topics

Resources

Stars

10 stars

Watchers

2 watching

Forks

Repository files navigation

dotfiles

CI

macOS dotfiles managed with chezmoi.

Initial setup

Follow these steps once on each new machine.

1. Clone the repository

git clone https://github.com/mono0x/dotfiles ~/.local/share/chezmoi
cd ~/.local/share/chezmoi

2. Install tools and apply dotfiles

./mise bootstrap

The included ./mise wrapper installs mise if needed. Bootstrap installs packages, configures macOS and the login shell, and applies the dotfiles with chezmoi. Package and tool definitions live in mise.toml and Brewfile.

Restart the macOS UI processes to reflect the settings:

killall Dock; killall Finder; killall SystemUIServer

3. Set up GitHub authentication

Git authenticates to GitHub through ghtkn. A launchd agent runs ghtkn agent start at login, and ghtkn-touchid unlocks it with a passphrase kept in Keychain behind Touch ID.

Generate a passphrase, store it in Keychain, and reset the agent with it:

ghtkn-touchid reset

The reset stops the agent. Start it again, then unlock it:

launchctl kickstart "gui/$(id -u)/com.github.suzuki-shunsuke.ghtkn.agent"
ghtkn-touchid unlock

Get an access token through the device flow:

ghtkn auth

ghtkn-touchid reset deletes the cached tokens, so run ghtkn auth again whenever you reset.

4. Set up commit signing

Git signs commits and tags with an SSH key stored in the Secure Enclave, so signing needs no Touch ID prompt.

During ./mise bootstrap and chezmoi apply, a macOS script sets up the key files if they are missing. It reuses the existing git-sign Secure Enclave identity or creates a non-exportable P-256 key that requires no user presence. expect answers the PIN prompt with an empty response automatically. If both key files already exist, the script does nothing. Key setup is skipped in GitHub Actions.

When the script places key files in ~/.ssh, it prints the public key path and GitHub registration instructions. Copy the public key:

pbcopy < ~/.ssh/id_ecdsa_sk_rk_git-sign.pub

Add it to GitHub as a signing key in SSH and GPG keys.

After each login

The ghtkn agent starts locked. Unlock it:

ghtkn-touchid unlock

Unlocking also enables refresh tokens, so you only need the device flow once per GitHub App, not every eight hours.

Maintenance

After upgrading ghtkn

The running agent keeps using the old binary. Restart and unlock it:

launchctl kickstart -k "gui/$(id -u)/com.github.suzuki-shunsuke.ghtkn.agent"
ghtkn-touchid unlock

Agent logs go to ~/Library/Logs/ghtkn-agent.log.

When retiring a machine

Delete its signing key from GitHub. Commits that GitHub has already verified stay verified.

Updating the mise wrapper

./mise is generated by mise. Regenerate it with:

mise generate install-script -w ./mise

About

dotfiles

Topics

Resources

Stars

10 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages