Setting up Mac for development — notes from a Windows user

Borek Bernard
5 min readJun 10, 2018

--

I’m a long-time Windows user, and while I’m relatively happy there and Microsoft is doing lots of things that I like (WSL, improving Git, contributing to Docker / Kubernetes, etc.), I wanted to try Mac for the first time.

These are my notes from setting it up for development, specifically, development of VersionPress which is a lot of Node.js, TypeScript, PHP and Docker.

At this point, I’ve spent about 10 hours on the MacBook (a couple more were running updates, just like on good old Windows 😃 ).

Prepare system

Update to latest OS version.

Turn on FileVault for disk encryption.

Install Xcode developer tools from App Store.

Homebrew & Cask

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"brew tap homebrew/cask
brew tap homebrew/cask-versions

Update / install development tools

# Core tools
brew install bash
brew install make
brew install git
brew install rsync
# iTerm2
brew cask install iterm2
# In Preferences > Profiles > Keys, select Natural Text Editing;
# makes Option-Left/Right work.
# I don't use vim regularly and it was pretty recent in High Sierra but anyway...
brew install vim --with-override-system-vi
# zsh
brew install zsh
brew install zsh-completions
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# Docker
brew cask install docker
# PHP
brew install php
brew install composer
brew install wp-cli
brew cask install phpstorm
# Switch to EAP in Settings > Updates
# Node.js
#brew install node # I prefer nvs
export NVS_HOME="$HOME/.nvs"
git clone https://github.com/jasongin/nvs "$NVS_HOME"
. "$NVS_HOME/nvs.sh" install
nvs add lts
nvs use lts
nvs link lts
# See https://github.com/jasongin/nvs for more
# Update npm (Node usually ships with an older version)
npm i -g npm
# Other useful tools
brew install httpie
brew install tldr
brew install htop
brew cask install clipy
brew cask install beyond-compare
# VSCode stable: main development, many extensions
brew cask install visual-studio-code
# VSCode insiders: lightweight editor
brew cask install visual-studio-code-insiders
# Add this to .zshrc:
# alias c=code-insiders
# export EDITOR='code-insiders --wait'
# Awesome Markdown editor
brew cask install caret
# Browsers for web development
brew cask install google-chrome
brew cask install google-chrome-canary
brew cask install firefox-developer-edition

It’s also possible to replace system utilities with their GNU counterparts, e.g., brew install coreutils --with-default-names and other things like findutils etc. I'm not sure at this point if it's a good idea, so skipping.

Chrome apps

Some “apps” come with my Chrome profile, just mentioning them here:

  • LastPass
  • Authy

Git and GitHub

Git config:

git config --global user.name "Borek Bernard"
git config --global user.email "borekb@gmail.com"

Enable caching of password when cloning via HTTPS (recommended):

git config --global credential.helper osxkeychain

Create a personal access token (necessary for 2FA), store it in LastPass, use it to clone a repo:

git clone https://github.com/versionpress/versionpress

Optionally set up Beyond Compare as a difftool and add some aliases. My current .gitconfig:

[user]
name = Borek Bernard
email = borekb@gmail.com
[diff]
tool = bc
[difftool "bc"]
path = "bcomp"
[merge]
tool = bc
[mergetool "bc"]
path = "bcomp"
[filter "lfs"]
required = true
clean = git-lfs clean %f
smudge = git-lfs smudge %f
[credential]
helper = osxkeychain
[push]
default = simple
[alias]
co = checkout
lg = log --color --graph --pretty=format:\"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\" --abbrev-commit
ss = status
po = remote prune origin
purge = "!git checkout master && git branch --no-color --merged | grep -v master | xargs -n 1 git branch -d && git checkout -"
remote-purge = "!git branch -r --merged | grep -v master | grep origin | sed 's/origin\\///' | xargs -n 1 git push --delete origin"
remote-purge-dryrun = "!git branch -r --merged | grep -v master | grep origin | sed 's/origin\\///' | xargs -n 1 echo"
stsh = stash --keep-index
staash = stash --include-untracked
staaash = stash --all
alias = config --get-regexp alias
list-branches-without-remote = "!git branch -vv | cut -c 3- | awk '$3 !~/\\[/ { print $1 }'"
dump = "!uploadStash=`git stash create`; git archive -o git-dump.zip ${uploadStash:-HEAD}"

VSCode

Install Settings Sync extension, download settings from Gist. This takes care of everything.

Some of my extensions I wouldn’t want to live without:

Less important but useful:

And then some language-specific like TSLint — Visual Studio Marketplace or PHP IntelliSense — Visual Studio Marketplace.

In VSCode Insiders (which I use as a relatively lightweight editor) I only keep three extensions:

Screenshots

Screenshots at 2880x1800 appear huge on non-retina displays which is not great for vast majority of users.

Skitch (brew cask install skitch) or Monosnap can downscale images on save (careful: not on copy to clipboard!).

Some other workaround include:

  • If you have an external monitor with “100% DPI”, take screenshots there.
  • Browsers and some other apps like VSCode can be zoomed out to 50% easily.

Closing thoughts

From a Windows user perspective that just switched:

  • Option-Left/Right instead of Ctrl+Left/Right to jump words is probably something I struggle with the most. I’m a heavy user of that feature and my muscle memory refuses to adapt.
  • Delete is another one (well, forward-delete). Forward-deleting a couple of words makes me stop and think a bit.
  • Command-… is quite natural after a while, for example, copy / pasting, finding, etc., all without problems. I was a bit worried about this.
  • I use two keyboards, US and Czech (QWERTY) and the physical labels on the keyboard don’t match either of those very well. I had to google how to do backtics, backslashes etc. 😃
  • Option-dash for ndash is a nice little touch.

Overall, I feel like the adaptation was pretty quick, perhaps because I already had a “Linux-y” setup on Windows. Two things that stand out for me on a Mac are:

  1. brew. I tried to use Chocolatey on Windows in the past but it is simply nowhere near the elegance and convenience of Homebrew and Cask. This would be my no. 1 wish for Windows ecosystem to sort out.
  2. There is a single shell — single way to do things. (Well, one could use Bash or zsh but those are easy to switch between.) On Windows, there are four major options at the moment: cmd.exe, PowerShell, Git Bash and bash/zsh via WSL. It is technically respectable that you can run many types of binaries and systems, but in my experience, it also introduces many edge cases and smaller issues, like npm assuming that the shell is cmd.exe while I'm in Git Bash, and similar. These problems simply don't exist on Mac.

Nothing really bothers me too much about the Mac so far, maybe the hardware a little bit (min-2015 MBP 15'’, it is heavy as hell), but overall, pretty happy. I expected I’d be paying for more things in the App Store 😃.

These resources were useful:

--

--