Macos setup automation with basic settings, application installs and dotfiles
- Backup credentials and personal settings by running
backup.sh path/to/backup.tgz - Copy backup and this repo to new mac
- Run
./setup.sh initand log in with your new non-superadmin user - If need keys or creds from backup for install, use
restore.sh path/to/backup.tgz - Run
./setup.sh init_userto remove dock icons and create ssh keys if needed - Run
./setup.sh install && ./setup.sh configand reboot your computer
There are still rough edges and you will probably have to fix something by hand, but it should still be quicker than starting over or using time machine..
backup.sh does a backup of the home directory files listed in
restore.bom. It includes hard to generalise plist settings
and credentials. Other files, such as documents are expected to be backed up
to file-sharing, e.g. google drive or dropbox.
restore.sh extracts the backup tarball back to home folder.
To add gpg key to gpg suite, e.g. from 1Password, copy the gpg key to key_public.asc
and key_secret.asc before running restore.sh.
The scripts take the path of the backup tarball as an argument.
setup.sh has three tasks/: init, install and
config. To use, run ./setup.sh <task> in the root folder of this repo.
- Sets up and asks for basic info such as hostname
- Installs updates and xcode devtools
- Turns off guest account
- Creates a new account to be used instead of the default macOS superadmin
./setup.sh init_usersubtask removes dock icons and usesinit_ssh_1password./setup.sh init_ssh_1passwordwrites ssh config to use 1password for ssh keys./setup.sh init_ssh_localcreates ssh key if you don't have one (from backup)
Also works as update, just rerun it to update apps and node. Python and ruby versions are still manual in the script for now.
- Installs Brew and libs, tools and software from Hombrew and Mac App Store
- See
Brewfiles/for commented lists of installed applications in Homebrew bundle format - Installed in order:
core, software
- See
- Sets default shell to Bash 5 instead of ancient Bash from macOS
- Installs lots of GNU utils to supplement and overwrite macOS builtins
- Installs language runtimes with Mise
- Latest or LTS version
- Node, Go, Rust, Zig, Ruby, Perl, Python (with uv)
- PHP is installed through Homebrew due to problems in mise install (see Brewfiles/core comments)
- Installs crudini and aiven-client with uv tools
- Bootstraps dotfiles subrepo
- Core dotfiles are in the
dotfilessubrepo - Personal and extra configs are in this repo at
.extra,.pathand.credentials.dist
- Core dotfiles are in the
- Applies some application settings and terminal/duti settings
- Applies basic settings macos settings as defined in
.macosdotfile
Not all steps have been automated:
- Postico favourites are backed up to file-share encrypted. Need to be imported manually.
- set up iterm2 key binds if backups don't work correctly: https://medium.com/@jonnyhaynes/jump-forwards-backwards-and-delete-a-word-in-iterm2-on-mac-os-43821511f0a
- Mathias Bynens for his dotfiles repository which is the upstream for the fork used here
- @ptb and his macOS Setup repository for inspiration and basis for installation scripts
- @bkuhlamnn and his mac_os(-config) repositories and dotfiles repository for inspiration and prior-art as well as some useful utility functions