This is the playbook I use after a clean install of MacOS to set everything up.
- Install ssh keys (Role
ssh
) - Installs Homebrew packages and app casks (Role
homebrew
) - Installs App Store apps with
mas-cli
(Rolemas
) - Modifies MacOS settings (Role
settings
) - Install other homebrew packages with custom installation process, e.g. omz (Role
custombrew
) - Stow .dotfiles (Role
custombrew
, taskdotfiles
)
Clone a repo in the home dir
cd ~
git clone https://github.com/sseletskyy/ansible-macos-playbook.git
- Install xcode
xcode-select --install
- Install homebrew
cd ~
git clone https://github.com/Homebrew/brew homebrew
export PATH=$HOME/homebrew/bin:$PATH
brew update --force --quiet
chmod -R go-w "$(brew --prefix)/share/zsh"
- Install ansible
brew install python
pip3 install ansible
cd ~/ansible-macos-playbook
-
Run
ansible-playbook main.yml --verbose --ask-vault-pass
. Enter your account password when prompted. Enter vault password when prompted. -
Or run specific role only
# ssh
ansible-playbook main.yml -t ssh --verbose --ask-vault-pass
# homebrew
ansible-playbook main.yml -t homebrew --verbose
# mas (Macos App Store)
# make sure you have signed in into icloud
ansible-playbook main.yml -t mas --verbose
# settings
ansible-playbook main.yml -t settings --verbose
# custom homebrew
ansible-playbook main.yml -t custombrew --verbose
Here's the solution (need to update to macOS 11.2 RC):
-
Run command in terminal:
sudo pmset -a tcpkeepalive 0
-
Run command in terminal:
sudo pmset -a powernap 0
-
Make sure these options is not checked: "System Preferences->Battery->Optimized battery charging" and "System Preferences->Battery->Power Adapter->Wake for network access"
-
Reboot your macbook