Skip to content

seadogger/mac-dev-playbook

 
 

Repository files navigation

Mac Development Ansible Playbook

This playbook installs and configures my Mac for general use and software development. This is a work in progress, and is mostly a means for me to document my current Mac's setup and learn Ansible.

See also:

Installation

  1. Ensure Apple's command line tools are installed (xcode-select --install to launch the installer).

  2. Install Ansible:

    1. Run the following command to add Python 3 to your $PATH: export PATH="$HOME/Library/Python/3.12/bin:/opt/homebrew/bin:$PATH"
    2. Upgrade Pip: sudo pip3 install --upgrade pip
    3. Install Ansible: pip3 install ansible
  3. Clone or download this repository to your local drive.

  4. Run ansible-galaxy install -r requirements.yml inside this directory to install required Ansible roles.

  5. Run ansible-playbook main.yml --ask-become-pass inside this directory. Enter your macOS account password when prompted for the 'BECOME' password.

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.

Note: On M1 Macs homebrew is installed in /opt/homebrew and all homebrew apps installed are located in /opt/homebrew/bin which is not in the default $PATH variable. This needs to be added to the $PATH to find these installated applications

Running a specific set of tagged tasks

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 -K --tags "dotfiles,homebrew"

Overriding Defaults

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

configure_dock: true
dockitems_remove:
  - Launchpad
  - TV
dockitems_persist:
  - name: "Sublime Text"
    path: "/Applications/Sublime Text.app/"
    pos: 5

Any variable can be overridden in config.yml; see the supporting roles' documentation for a complete list of available variables.

Default Applications and Configuration to Install

Applications (installed with Homebrew Cask):

Packages (installed with Homebrew):

  • autoconf
  • bash-completion
  • doxygen
  • gettext
  • gifsicle
  • git
  • gh
  • go
  • gpg
  • httpie
  • iperf
  • libevent
  • sqlite
  • mcrypt
  • nmap
  • node
  • nvm
  • php
  • ssh-copy-id
  • readline
  • openssl
  • pv
  • wget
  • mas
  • packer
  • terraform
  • awscli
  • libftdi
  • netpbm
  • numpy
  • pyenv
  • zsh-history-substring-search
  • scipy
  • iperf3

Pip Installed Packages:

Mac App Store Installed Apps:

Visual Studio Code Extensions (Visual Studio Code must be in list of Homebrew Casks above)

My dotfiles are also installed into the current user's home directory, including the .osx dotfile for configuring many aspects of macOS for better performance and ease of use. You can disable dotfiles management by setting configure_dotfiles: no in your configuration.

Finally, there are a few other preferences and settings added on for various apps and services.

Manual Stuff TODO

  1. Configure extra Mail and/or Calendar accounts (e.g. Google, Exchange, etc.).
  2. Enable the license codes within Word, Excel, Powerpoint, Makemkv, Plex
  3. Set the fileBot default format string for video file conversion {plex}'-'{vf}{vc}.mkv
  4. Install PixInsight (Need to down load), StarNet++ v2 with M1, BatchFitsKeywordEdit, GHS Script, HVB Scripts, EZ Suite, Star De-emphasizer
  5. install tunnels for Wireguard using the QR codes from Wireguard Server
  6. Install StellarMate (App store)

Ansible for DevOps

Check out Ansible for DevOps, which teaches you how to automate almost anything with Ansible.

Author

Seadogger, 2019 Forked from Jeff Geerling - Mac Dev Playbook.

Troubleshooting

Visual Studio Code Plugins not working

open Visual Studio Code

Open the Command Palette via (⇧⌘P) and type shell command to find the Shell Command:

Install 'code' command in PATH** command.

Dock Crashes and Continously tries to restart

System Console Error

Process:               Dock [32541]
Path:                  /System/Library/CoreServices/Dock.app/Contents/MacOS/Dock
Identifier:            com.apple.dock
Version:               1.8 (2044.6.1)
Build Info:            Dock-2044006001000000~61
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Dock [32541]
User ID:               501

Date/Time:             2020-03-08 12:08:51.511 -0400
OS Version:            Mac OS X 10.15.3 (19D76)
Report Version:        12
Anonymous UUID:        3E6E01AE-21A0-A32C-0B36-BC750009B8CB

System Console Error Log Details

Time Awake Since Boot: 36000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
dyld3 mode
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString unsignedIntValue]: unrecognized selector sent to instance 0x6000032d1040' terminating with uncaught exception of type NSException abort() called

Application Specific Backtrace 1:
0   CoreFoundation                      0x00007fff3a29238b __exceptionPreprocess + 250
1   libobjc.A.dylib                     0x00007fff70470552 objc_exception_throw + 48
2   CoreFoundation                      0x00007fff3a3117f0 -[NSObject(NSObject) __retain_OA] + 0
3   CoreFoundation                      0x00007fff3a1f69f4 ___forwarding___ + 1427
4   CoreFoundation                      0x00007fff3a1f63d8 _CF_forwarding_prep_0 + 120
5   Dock                                0x0000000101517115 Dock + 49429
6   Dock                                0x0000000101516c84 Dock + 48260
7   Dock                                0x0000000101516786 Dock + 46982
8   Dock                                0x0000000101514222 Dock + 37410
9   Dock                                0x0000000101512c5f Dock + 31839
10  Dock                                0x0000000101670a55 Dock + 1464917
11  Dock                                0x000000010167150e Dock + 1467662
12  libswiftObjectiveC.dylib            0x00007fff7147bf0e$s10ObjectiveC15autoreleasepool8invokingxxyKXE_tKlF + 46
13  Dock                                0x0000000101510fc7 Dock + 24519
14  libdyld.dylib                       0x00007fff717d27fd start + 1

Corrective Action

Run the following command in a terminal window

rm ~/Library/Application\ Support/Dock/desktoppicture.db

About

Mac setup and configuration via Ansible.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Jinja 83.1%
  • Shell 16.9%