/mac-dev-setup

Setup for my Mac development environment using Ansible

Primary LanguageShell

Mac Development Setup

This is my automated setup for most of the software I use on my Mac for development. The purpose of this is to keep an ongoing list of what I am using in my environment and to have an automated way to rebuild it in case I ever need to. If you find the software list below useful, then please use this as it could save you a few hours vs doing it manually yourself. It is also customizable with its own configuration if you want to modify which software/programs get installed on your machine as well.

Installation

  1. ensure you have python3 and pip installed. You typically do if you have a late-ish MacOS ( El Capitan and above ).
  2. Create a virtual environment and install ansible in it - for this example, lets just create the virtualenv in our $HOME
python3 -m venv ~/venvs/mac_ansible
source ~/venvs/mac_ansible/bin/activate
pip3 install ansible
  1. Run the playbook
ansible-playbook playbook.yml --ask-become-pass
  1. Provide the sudo passwords when it asks
  2. ...
  3. Profit

Included Applications / Configurations:

Applications (installed with Homebrew Cask):

Programs (installed with Homebrew):

  • vim
  • git
  • wget
  • htop
  • nmap
  • sqlite
  • go
  • node

Dotfiles:

It installs all the dotfiles from my dotfiles repo. If you have your own dotfiles you want to use instead, simply set your dotfiles_items and or your own dotfiles_repo in a custom.config.yml and this will take care of that for you.

Overriding Default Application / Programs

You may want to customize which applications and or programs that get installed through Brew / Cask / Pip etc. Its easy to do, simply create a file called custom.config.yml (included in this repo) and place it in the root of this directory (same directory that playbook.yml and this README is in), and then add your own items.

Example custom.config.yml:

# Install my .dotfiles from my repo here: https://github.com/nickmaccarthy/dotfiles
dotfiles_install: True

# Set the default shell to bash.  On recent version of OSX, this has been zsh.  I typically do all my scripting in bash, so I am overwriting here.
default_shell: bash

brew_base_items:
  - openssl
  - vim
  - git
  - wget
  - node

brew_cask_items:
  - docker
  - iterm2
  - vagrant
  - virtualbox

pip_items:
  - virtualenv

Adding additional Applications / Programs

If you are satisfied with the default application/program list, but want to add a few more items, you can do so by adding you items to the additional item lists

Example:

additional_brew_cask_items:
  - visual-studio-code

Shell support

By default, this will install zsh and the powerlevel10k zsh theme. zsh has just been easier to manage on modern macs vs bash, so I've switched over to using it. At the time of this writing, I'm liking the powerlevel10k theme, so I'm installing it by default. It installs enough to get you going, but if you run a p10k configure, it will not overwrite your future changes.

M Series (M1) mac support

The times they are a changin'. I have recently purchased a new M series Mac, and while running this playbook, I noticed homebrew, etc gets installed into a different directoy. I have updated this playbook to account for M series systems and defined facts that should work between both M1 and Intel architectures. If you run into any issues, let me know by opening an issue.

Changelog

  • 2021-04-04 - Powerlevel10k zsh theme added
  • 2021-07-03 - Fixed various bugs and added support for M series macs, set default shell to zsh and added ohmyzsh!
  • 2021-03-02 - Added tags as well as kubectl, helm and kops
  • 2021-02-18 - Getting things to work with python3 and later version of OSX like Catalina and Big Sur.
  • 2018-11-20 - Added support for Ansible 2.4+. Added custom.config.yml to main repo. Modified runit.sh to add tests.
  • 2017-07-19 - Added support for consolas font installation, checkout tasks/consolas.yml for more details

Author

Nick MacCarthy, 2016. Inspired by the mac setup of Jeff Geerling