| Branch | Coding Style |
|---|---|
| master |
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.14 (Mojave) or later
- Xcode (Command Line Tools) 11 or later installed
- Xcode (Command Line Tools) 12 or later recommended on macOS Catalina
- Git installed (provided with Xcode Command Line tools)
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
./setupYou 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.yamlThe 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.
iTerm2 and Terminus terminal applications will be installed on all environments.
To install Google Drive File Stream:
install_gdfs: trueTo install Slack desktop application:
install_slack: trueLatest version of Zsh will be installed from Homebrew.
- GNU Wget
- GNU sed as
gsedcommand - GNU tar as
gtarcommand - jq command-line JSON processor
- The Silver Searcher (
agcommand) 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 install-toolsTo install Hazel automation tool:
install_hazel: trueTo install Hammerspoon automation tool:
install_hammerspoon: trueVisual 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: trueTo install JetBrains Toolbox to install and manage JetBrains applications:
install_jetbrains_toolbox: trueYou can install asdf version manager by adding the following option to your
machine.yaml:
install_asdf: trueTo configure asdf plugins and package versions to install, add
them into your machine.yaml configuration.
asdf_plugins:
- name: kubectl
- name: concourseNote 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 v3.7 installed with pyenv
Run Python playbook:
make install-pythonYou can disable installation by adding the following option to your
machine.yaml:
install_python: falseThe 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: falseTo install Ruby for development, enable it in your machine.yaml configuration:
install_ruby: trueThis will install:
- rbenv using zzet.rbenv role
- Ruby version 2.6.3 with rbenv
Run Ruby playbook:
make install-rubyTo 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.3The 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 NVM
Run Node.js playbook:
make install-nodeYou can disable installation by adding the following option to your
machine.yaml:
install_nodejs: falseGo programming language installed using markosamuli.golang Ansible role.
Run Go playbook:
make install-golangYou can disable installation by adding the following option to your
machine.yaml:
install_golang: falseYou can install Lua programming language by adding the following option
to your machine.yaml file:
install_lua: trueRun Lua playbook:
make install-luaThis will also install LuaRocks package manager and luacheck rock using the custom luarocks module.
Install Rust programming language:
install_rust: trueTo avoid modifying path during install:
rust_modify_path: falseRun Rust playbook:
make install-rustTo uninstall Rust, run:
rustup self uninstallLatest 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: trueDocker for Mac will be installed by default.
Run Docker playbook:
make install-dockerTo disable installation, add:
install_docker: falseInstall Certbot with:
install_certbot: trueInstall Nmap utility for network discovery and security auditing by adding:
install_nmap: trueTo install Packer add:
install_packer: trueInstall 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 install-terraformDisable Terraform installation with:
install_terraform: falseInstall doctl using Homebrew package manager by adding the following option to
your machine.yaml:
install_doctl: trueThis 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 install-awsYou can disable installation by adding the following option to your
machine.yaml:
install_aws: falseGoogle 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 install-gcloudDefault 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: ~/optThe 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: falseYou can disable installation by adding the following option to your
machine.yaml:
install_gcloud: falseThe 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:
make install-rolesTo update roles to the latest release versions:
make update-rolesTo remove any outdated roles:
make clean-roles| Role | Build status |
|---|---|
| markosamuli.asdf | |
| markosamuli.aws_tools | |
| markosamuli.gcloud | |
| markosamuli.golang | |
| markosamuli.nvm | |
| markosamuli.packer | |
| markosamuli.pyenv | |
| markosamuli.rust | |
| markosamuli.vagrant | |
| zzet.rbenv | ![]() |
Install pre-commit hooks:
make setup-git-hooksLint code and configuration:
make lintThis is based on my previous setup markosamuli/machine that was forked off from caarlos0/machine to suit my needs.
