Branch | Status |
---|---|
master | |
develop |
This is a collection of Ansible roles and tasks to setup a new developer machine on macOS.
Read my Machine Setup Guide for instructions.
- Mac running macOS 10.13 (High Sierra) or later
- Xcode 10.1 or later installed
- Git installed
This setup has only been tested on the macOS Sierra and not against existing installations.
See markosamuli/linux-machine for my Ubuntu Linux setup.
You can run the installer script that will clone the code from GitHub and run
the setup
script.
curl -s https://raw.githubusercontent.com/markosamuli/macos-machine/master/install.sh | bash -
Clone this project locally and run the ./setup
script.
git clone https://github.com/markosamuli/macos-machine
cd macos-machine
./setup
You can pass custom variables to the Ansible playbook and roles by creating
a machine.yaml
file to customise your configuration.
cp machine.yaml.example machine.yaml
The setup
script will detect if this file exists and passes it to the
Ansible Playbook with --extra-vars
.
The following tools are prerequisites and always installed during setup if not already found on the system.
- Xcode Command Line Tools
- Homebrew
- Ansible v2.7 installed with Homebrew
- Python v3.7 installed with Homebrew
iTerm2 terminal will be installed on all environments.
To install Google Drive File Stream:
install_gdfs: true
To install Slack desktop application:
install_slack: true
Latest version of Zsh will be installed from Homebrew.
- GNU Wget
- GNU sed as
gsed
command - GNU tar as
gtar
command - jq command-line JSON processor
- The Silver Searcher (
ag
command) code searching utility similar toack
- htop process viewer for console
- ShellCheck static analysis tool for shell scripts
- shfmt formatter for shell scripts
- asciinema for recording terminal session
Run tools playbook:
make tools
To install Hazel automation tool:
install_hazel: true
To install Hammerspoon automation tool:
install_hammerspoon: true
Visual Studio Code will be installed on all environments.
Latest Vim package will be installed from Homebrew.
To install MacVim instead of Vim, update machine.yaml
with the following
configuration:
install_macvim: true
To install JetBrains Toolbox to install and manage JetBrains applications:
install_jetbrains_toolbox: true
You can install asdf version manager by adding the following
option to your machine.yaml
:
install_asdf: true
To configure asdf plugins and package versions to install, add them
into your machine.yaml
configuration.
asdf_plugins:
- name: kubectl
- name: concourse
Note that some of the playbooks remove conflicting asdf plugins and versions if a respective tool is installed using another package or version manager.
Use pyenv to install and manage Python versions for the current user:
- pyenv
- pyenv-virtualenv
- Python v2.7 and v3.7 installed with pyenv
Run Python playbook:
make python
You can disable installation by adding the following option to
your machine.yaml
:
install_python: false
The markosamuli.pyenv role will modify your .bashrc
and .zshrc
files
during the setup. If you want to disable this, edit machine.yaml
file
and disable the following configuration option.
pyenv_init_shell: false
To install Ruby for development, enable it in your machine.yaml
configuration:
install_ruby: true
This will install:
- rbenv using zzet.rbenv role
- Ruby version 2.6.3 with rbenv
Run Ruby playbook:
make ruby
To change the installed rubies and default version, add the following to your
machine.yaml
file and customize it to your needs:
rbenv:
env: user
version: v1.1.2
default_ruby: 2.6.3
rubies:
- version: 2.6.3
The role doesn't update your .bashrc
or .zshrc
files, so you need to add
something like below to initialize rbenv in your shell:
if [ -z "${RBENV_ROOT}" ]; then
if [ -d "$HOME/.rbenv" ]; then
export PATH=$HOME/.rbenv/bin:$PATH;
export RBENV_ROOT=$HOME/.rbenv;
eval "$(rbenv init -)";
fi
fi
- Node Version Manager (NVM)
- Node.js LTS installed with NMV
Run Node.js playbook:
make node
You can disable installation by adding the following option to
your machine.yaml
:
install_nodejs: false
Go programming language installed using markosamuli.golang Ansible role.
Run Go playbook:
make golang
You can disable installation by adding the following option to
your machine.yaml
:
install_golang: false
You can install Lua programming language by adding the following
option to your machine.yaml
file:
install_lua: true
Run Lua playbook:
make lua
This will also install LuaRocks package manager and luacheck rock using the custom luarocks module.
Install [Rust] programming language:
install_rust: true
To avoid modifying path during install:
rust_modify_path: false
Run Rust playbook:
make rust
To uninstall Rust, run:
rustup self uninstall
Latest version of Git will be installed from Homebrew.
Vagrant and VirtualBox are no longer installed by default, but you can enable them by adding:
install_vagrant: true
Docker for Mac will be installed by default.
Run Docker playbook:
make docker
To disable installation, add:
install_docker: false
Install Certbot with:
install_certbot: true
Install Nmap utility for network discovery and security auditing by adding:
install_nmap: true
To install Packer add:
install_packer: true
Install tfenv version manager for Terraform and install the latest version.
Any previous conflicting installations using asdf or markosamuli.terraform role are removed.
Run Terraform playbook:
make terraform
Disable Terraform installation with:
install_terraform: false
Install doctl using Homebrew package manager by adding the following
option to your machine.yaml
:
install_doctl: true
This will uninstall any conflicting asdf plugins and versions.
- AWS CLI
- aws-shell - interactive shell for AWS CLI
- AWS Vault - a vault for securely storing and accessing AWS credentials in development environments
- cli53 - command line tool for Amazon Route 53
Run AWS playbook:
make gcloud
You can disable installation by adding the following option to
your machine.yaml
:
install_aws: false
Google Cloud SDK installed from the archive file under user home directory. You shouldn't try to install a global version with these playbooks.
Run Google Cloud SDK playbook:
make gcloud
Default install path is in ~/google-cloud-sdk
, but you can
install it to another location, for example if you prefer
~/opt/google-cloud-sdk
add the following option:
gcloud_install_path: ~/opt
The markosamuli.gcloud role will modify your .bashrc
and .zshrc
files.
To disable this and manage the configuration yourself, disable the following
configuration option in the machine.yaml
file:
gcloud_setup_shell: false
You can disable installation by adding the following option to
your machine.yaml
:
install_gcloud: false
The installer creates empty ~/.bash_profile
and ~/.bashrc
files and makes
sure ~/.bashrc
is loaded from ~/.bash_profile
.
The installer makes changes to your ~/.bashrc
and ~/.zshrc
files, so take
backup copies of them before running the script.
The following external Ansible roles are installed and used. See requirements.yml file for the installed versions.
To install roles and forcibly update any existing ones:
make roles
To update roles to the latest release versions:
make update
Role | Build status |
---|---|
markosamuli.asdf | |
markosamuli.aws_tools | |
markosamuli.gcloud | |
markosamuli.golang | |
markosamuli.nvm | |
markosamuli.packer | |
markosamuli.pyenv | |
markosamuli.terraform | |
markosamuli.vagrant |
Fix ansible-lint installation issues:
pip install virtualenv==16.3.0
Install pre-commit hooks:
make install-git-hooks
Lint code and configuration:
make lint
This is based on my previous setup markosamuli/machine that was forked off from caarlos0/machine to suit my needs.