This work is inspired by geerlingguy work on automating the setup for Mac Book. For installing the oh my zsh package I took inspiration from RaymiiOrg.
This playbook installs and configures most of the software I use on my Mac for software development. I combined the two ansible automated setups and added my own tools like Github Desktop & Tabset. The complete list of softwares are listed below.
I have also automated the installation of Atom packages. This is inspired from the playbook of Fusion The details related to Atom packages can be found in atom-packages-setup.yml file.
This is a work in progress, and is mostly a means for me to document my current Mac's setup. I'll be evolving this set of playbooks over time.
- Ensure Apple's command line tools are installed (
xcode-select --install
to launch the installer). - Install Ansible.
- Clone this repository to your local drive.
- Run
$ ansible-galaxy install -r requirements.yml
inside this directory to install required Ansible roles. - Run
ansible-playbook main.yml -i inventory -K
inside this directory. Enter your account password when prompted.
Note: If some Homebrew commands fail, you might need to agree to Xcode's license or fix some other Brew issue. Run
brew doctor
to see if this is the case.
You can filter which part of the provisioning process to run by specifying a set of tags using ansible-playbook
's --tags
flag. The tags available are dotfiles
, homebrew
, mas
, extra-packages
and osx
.
ansible-playbook main.yml -i inventory -K --tags "dotfiles,homebrew"
Not everyone's development environment and preferred software configuration is the same.
You can override any of the defaults configured in default.config.yml
by creating a config.yml
file and setting the overrides in that file. For example, you can customize the installed packages and apps with something like:
homebrew_installed_packages:
- cowsay
- git
- go
mas_installed_apps:
- { id: 443987910, name: "1Password" }
- { id: 498486288, name: "Quick Resizer" }
- { id: 557168941, name: "Tweetbot" }
- { id: 497799835, name: "Xcode" }
composer_packages:
- name: hirak/prestissimo
- name: drush/drush
version: '^8.1'
gem_packages:
- name: bundler
state: latest
npm_packages:
- name: webpack
pip_packages:
- name: mkdocs
Any variable can be overridden in config.yml
; see the supporting roles' documentation for a complete list of available variables.
Applications (installed with Homebrew Cask):
- Atom
- Adobe Acrobat Reader
- CheetSheet
- Docker
- Dropbox
- Firefox
- Github
- Google Chrome
- iTerm2
- Java
- MacPass
- Spectacle
- Sublime Text
- Vagrant
- VirtualBox
- Visual Studio Code
Packages (installed with Homebrew):
Atom packages and Themes (installed with hnakamu role)
- change-tabs
- color-tabs
- file-icons
- atom-material-ui
- atom-material-syntax-dark
- wakatime
Visual Studio Code extensions
- autoimport
- vscode-docker
- csharp
- vscode-icons
- githistory
- vscode-auto-open-markdown-preview
- docker-explorer
- ansible-autocomplete
- python
- vscode-flake8
- one-monokai
- wakatime
- MarkdownLint
- EditorConfig
- gitignore
- Language support for Java by Redhat
- code-spell-checker
- Java Language support using Compiler API
As per the original playbook from geerlingguy, there is an option to configure the dotfiles. I have disabled this option by setting the configure_dotfiles: no flag.
Ansible role hnakamu is used for managing Atom packages.
I faced problems while setting zsh as the default shell. I have commented the lines in oh-my-zsh-setup.yml file which tries to set the default shell. The original oh-my-zsh setup file had user name passed as a variable. I changed this a bit to use the current user from environment variables.
Finally, there are a few other preferences and settings added on for various apps and services.
Note that the Spectacle application installs successfully but it requires access to Accessibility settings. Because of this it reports failure. I ran the playbook once to overcome this problem and then comment the line in the config which installs this app. Rerunning the playbook installs all the other packages and tools.
Next step is to automate the installation of plugins for Sublime.
It's my hope that I can get the rest of these things wrapped up into Ansible playbooks soon, but for now, these steps need to be completed manually (assuming you already have Xcode and Ansible installed, and have run this playbook).
- Set JJG-Term as the default Terminal theme (it's installed, but not set as default automatically).
- Install Sublime Package Manager.
- Install all the apps that aren't yet in this setup (see below).
- Remap Caps Lock to Escape (requires macOS Sierra 10.12.1+).
- Set trackpad tracking rate.
- Set mouse tracking rate.
- Configure extra Mail and/or Calendar accounts (e.g. Google, Exchange, etc.).
I was able to install IntelliJ Idea. There is a Ansible role by GantSign for installing plugins for IntelliJ. I am facing some problem getting the role to work properly. For time being I have installed the plugins using IDE. In future will work to fix the issue with role and automate the deployment of plugin as well.
-
In order for iTerm2 terminal to pick oh my zsh as the default shell the command needs to be customized:
In the preferences for iTerm2 select the startup command as /bin/zsh --login
-
The CheetSheet & Specktacle applications require access to Accesibility settings. These need to be manually configured for time being.
Use the Awk script to install Nerd fonts which help to improve look and feel for the Terminal when using oh-my-zsh and other terminal utilities in iTerm or Warp terminals Awk script[https://gist.github.com/davidteren/898f2dcccd42d9f8680ec69a3a5d350e]
The project is continuously tested using Travis CI's MacOS infrastructure.
Nilesh Gule, 2017 (originally inspired by following authors)