Automated setup for macOS development environment using Ansible. This playbook configures a fresh any Mac with development tools, applications, and sensible defaults.
- Homebrew Package Management - CLI tools and GUI applications
- Development Environment - Languages, Git config, SSH keys
- macOS System Preferences - Dock, Finder, keyboard, trackpad settings
- Dotfiles Management - Clone and symlink your dotfiles
- Fully Customizable - Everything configured via variables
- macOS Ventura (13.0) or later
- Command Line Tools for Xcode
xcode-select --install- Clone this repository:
git clone https://github.com/koolwilly72/mac-setup.git
cd mac-setup- Install Ansible:
# Using Homebrew (if already installed)
brew install ansible
# Or using pip
pip3 install --user ansible- Install required Ansible collections:
ansible-galaxy install -r requirements.yml- Customize your configuration:
cp group_vars/all.yml group_vars/all.yml.bak
# Edit group_vars/all.yml with your preferences- Run the playbook:
ansible-playbook site.yml -KThe -K flag prompts for your sudo password (required for some operations).
All configuration is done in group_vars/all.yml. Key sections include:
homebrew_packages:
- git
- neovim
- tmuxhomebrew_casks:
- visual-studio-code
- docker
- slackdevelopment_languages:
- python@3.12
- node
- gogit_user_name: "Your Name"
git_user_email: "your.email@example.com"macos_dock_autohide: true
macos_finder_show_hidden: true
macos_key_repeat_rate: 2dotfiles_repo: "https://github.com/koolwilly72/dotfiles.git"
dotfiles_symlink: trueansible-playbook site.yml -K# Only install Homebrew packages
ansible-playbook site.yml --tags homebrew -K
# Only configure macOS defaults
ansible-playbook site.yml --tags macos -K
# Only setup development tools
ansible-playbook site.yml --tags development -Kansible-playbook site.yml --check -Kansible-playbook site.yml -K -vvvmac-setup/
├── site.yml # Main playbook
├── requirements.yml # Ansible Galaxy dependencies
├── group_vars/
│ └── all.yml # Configuration variables
├── inventory/
│ └── hosts # Inventory file
└── roles/
├── homebrew/ # CLI package management
├── apps/ # GUI applications
├── development/ # Languages & dev tools
├── dotfiles/ # Dotfile management
└── macos-defaults/ # System preferences
First, find the app ID using mas:
brew install mas
mas search "App Name"Then add to group_vars/all.yml:
mas_apps:
- id: 497799835
name: "Xcode"
- id: 803453959
name: "Slack"homebrew_taps:
- homebrew/cask-fonts
- hashicorp/tappython_packages:
- black
- poetry
- django
node_packages:
- yarn
- nx
- vercelThis playbook is idempotent—running it multiple times will not cause issues. It will only make changes when necessary.
Some operations require sudo. Always run with -K:
ansible-playbook site.yml -KIf Homebrew fails, ensure it's properly installed:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Install required collections:
ansible-galaxy install -r requirements.yml --forceSome casks might fail if already installed via other means. These errors are ignored by default.
- Fork the repository
- Create your feature branch (
git checkout -b feature/new-feature) - Commit your changes (
git commit -m 'Add new feature') - Push to the branch (
git push origin feature/new-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by various dotfile and Mac setup repositories
- Built with Ansible
- Uses Homebrew for package management
- dotfiles - Your unofficial guide to dotfiles on GitHub
- awesome-macos-command-line - macOS command line tools