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 init
and 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_user
to remove dock icons and create ssh keys if needed - Run
./setup.sh install && ./setup.sh config
and 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_user
subtask removes dock icons and usesinit_ssh_1password
./setup.sh init_ssh_1password
writes ssh config to use 1password for ssh keys./setup.sh init_ssh_local
creates 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, languages, software
- See
- Sets default shell to Bash 5 instead of ancient Bash 3 from macOS
- Installs language runtimes
- Go, PHP, Lua, Rust and Java through with Homebrew
nvm
(Node Version Manager) and with it the LTS version of node- Python 2, Python 3, pip & utilities with
pyenv
- Also installs
aiven-client
for controllin Aiven DBaaS
- Also installs
- Ruby 3 and bundler with
rbenv
- Perl 5 with
plenv
(disabled currently due to install problems)
- Bootstraps dotfiles subrepo
- Core dotfiles are in the
dotfiles
subrepo - Personal and extra configs are in this repo at
.extra
,.path
and.credentials.dist
- Core dotfiles are in the
- Applies some application settings and terminal/duti settings
- Applies basic settings macos settings as defined in
.macos
dotfile
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