Skip to content

ilyatulvio/macos-machine

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Development macOS Setup

Branch Status
master Build Status
develop Build Status

This is a collection of Ansible roles and tasks to setup a new developer machine on macOS.

Read my Machine Setup Guide for instructions.

Requirements

  • 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.

Install

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 -

Getting Started

Clone this project locally and run the ./setup script.

git clone https://github.com/markosamuli/macos-machine
cd macos-machine
./setup

Local options

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.

Software installed by the playbooks

Installation tools

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

Desktop applications

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

Shell

Latest version of Zsh will be installed from Homebrew.

Command line tools

Run tools playbook:

make tools

macOS customization and automation

To install Hazel automation tool:

install_hazel: true

To install Hammerspoon automation tool:

install_hammerspoon: true

Editors

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

asdf version manager

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.

Python

Use pyenv to install and manage Python versions for the current user:

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

Ruby

To install Ruby for development, enable it in your machine.yaml configuration:

install_ruby: true

This will install:

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.js

Run Node.js playbook:

make node

You can disable installation by adding the following option to your machine.yaml:

install_nodejs: false

Go

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

Lua

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.

Rust

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

Git

Latest version of Git will be installed from Homebrew.

Vagrant and VirtualBox

Vagrant and VirtualBox are no longer installed by default, but you can enable them by adding:

install_vagrant: true

Docker

Docker for Mac will be installed by default.

Run Docker playbook:

make docker

To disable installation, add:

install_docker: false

Certbot

Install Certbot with:

install_certbot: true

Nmap

Install Nmap utility for network discovery and security auditing by adding:

install_nmap: true

Packer

To install Packer add:

install_packer: true

Terraform

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

Digital Ocean

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.

Amazon Web Services

  • 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 Platform

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

Changes to existing configuration

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.

Ansible Roles

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 Build Status
markosamuli.aws_tools Build Status
markosamuli.gcloud Build Status
markosamuli.golang Build Status
markosamuli.nvm Build Status
markosamuli.packer Build Status
markosamuli.pyenv Build Status
markosamuli.terraform Build Status
markosamuli.vagrant Build Status

Development

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

References

This is based on my previous setup markosamuli/machine that was forked off from caarlos0/machine to suit my needs.

License

Authors

About

macOS development machine setup

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 60.8%
  • Python 29.5%
  • Makefile 9.6%
  • JavaScript 0.1%