Setting up your mac for design & development is painful. It takes quite a few steps to get to a happy place where you are productive again. This post is a messy, note-to-self kind of list of what needs to be done to get from a blank Mac to the happy place. It also contains some bonus tips/reminders on useful tricks and commands sprinkled in.

Also, I am pretty damn sure the world needs one more "How I setup my Mac" -post, so here goes. Hopefully, you will find something new! Enjoy.

The article is being updated to reflect the latest discoveries [LAST UPDATED: 20.5.2020].

Update, install Xcode and Homebrew

After the Apple's setup wizard you should proceed to check the app store for updates. It's likely that your "new" mac is a few updates behind and it's best to install all those first. Who knows what kind of security holes those updates are patching.

Once the updates are in, proceed by heading to the App Store and installing the latest Xcode.

REMEMBER TO RUN Xcode and agree to the license agreement to finish installing it. XCode installs some important extras on the first run, so if you forget to run it you'll be left scratching your head why things do not work.

Then install the command line tools by copy-pasting the following into your terminal:

xcode-select --install

Install Homebrew

Homebrew is the go-to Unix package manager for OS X. Needed to install lots of the stuff in this guide.

Get brew at: http://brew.sh/

Get your terminal right

Below you will find instructions on how to configure ZSH and a lot of nice terminal related goodies.

Switch to iTerm2

You won't look back at the default mac terminal.

Get it at: https://www.iterm2.com/

Oh My Zsh

Switching bash to ZSH is great. Adding Oh My Zsh on top of ZSH is super.

Get it at: http://ohmyz.sh/

And while upgrading the terminal experience, you should drop in these as well:

Set up SUDO with TouchID

Have a long and complex admin password? Worry no more, you can use your fingerprint scanner aka. TouchID instead if your Mac has one. Here's how:

  1. Open /etc/pam.d/sudo and add auth sufficient pam_tid.so to the top of the file
  2. Change iTerm setting under Preferences > Advanced > Allow sessions to survive after logging out and back in to no
  3. Restart iTerm and profit

Install fzf for better command line history

This really improves your life when looking at the history of commands you've used by doing all sorts of magical fuzzy matching. Makes re-running common commands a joy.

https://github.com/junegunn/fzf

Better default tools

Nowadays there are better alternatives to many common Unix commands that we use daily. Here are some of the best ones.

Replace cat with bat, to make your cats look prettier.

brew install bat

Replace ping with pretty ping - again looks prettier.

brew install prettyping

A nicer way to see disk usage by usingn ncdu.

brew install ncdu

A better help by using tldr.

brew install tldr

A better grep that understands .gitignore files.

brew install ag

Broot allows handy viewing of folders in the terminal.

brew install broot

Then add the below to your .zshrc or similar to make it all work (NOTE: You should have fzf installed).

# improve common commands by using modern versions
alias cat='bat'
alias ping='prettyping --nolegend'
alias du="ncdu --color dark -rr -x --exclude .git --exclude node_modules"
alias help='tldr'

# add a nice way to preview files
alias preview="fzf --preview 'bat --color \"always\" {}'"

# add support for ctrl+o to open selected file in Oni
export FZF_DEFAULT_OPTS="--bind='ctrl-o:execute(oni {})+abort'"

Make sure you get git

Setup git committer info

Git requires your info, so it can add your info into the commits you create. Note that the commands below set a global identity on your mac. You can also configure it by the project by omitting the global switch.

git config --global user.email "jussi(at)wingmen.fi"
git config --global user.name "Jussi Kaijalainen"

Add git aliases

Open ~/.gitconfig and add the following lines. This adds some nice colors and two commands (git lol & git lola) to view the log in a nicer way.

[alias]
        lol = log --graph --decorate --pretty=oneline --abbrev-commit
        lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
[color]
        branch = auto
        diff = auto
        interactive = auto
        status = auto
[push]
    default = simple

Setup languages and infrastructure

Below you will find instructions on how to install stuff like Node, Python, MongoDB, Redis, Docker etc. running on your mac the right way.

Install Node via NVM

NVM makes it possible to run multiple versions of Node without a huge headache. This is really handy when dealing with older projects that might not run happily with the latest versions of Node.

Get it at: https://github.com/creationix/nvm

Then restart your terminal and run the following commands to set up the latest stable Node as the default:

nvm install stable

In some cases you might need to have node linked to /usr/local/bin/node, so here are the commands required for that:

ln -s /Users/<user>/.nvm/versions/node/<version>/bin/node /usr/local/bin/node
ln -s /Users/<user>/.nvm/versions/node/<version>/bin/npm /usr/local/bin/npm
ln -s /Users/<user>/.nvm/versions/node/<version>/bin/npx /usr/local/bin/npx

Install Python using PYENV

Playing around with all those machine learning frameworks is a headache without PYENV, which enables you to switch your Python version painlessly.

curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

Or check latest instructions at: https://github.com/pyenv/pyenv-installer

Install mas-cli

Mas-cli is the Mac App Store command line interface. It allows you to quickly install apps via commandline from the Mac App Store.

Install mas with: brew install mas

Install Android Studio & Java

If you're looking to develop hybrid apps using Cordova you will need to install both the Android Studio & Java and also get all the path variables correctly.

Get Studio at: https://developer.android.com/studio/install.html

Run below to accept all licenses:

yes | sudo ~/Library/Android/sdk/tools/bin/sdkmanager --licenses

Also, you will likely want to activate debugging mode on your Android phone to enable running the app easily.

See instructions: https://developer.android.com/studio/run/device.html

Install JDK8:

# To install JDK8
brew cask install adoptopenjdk/openjdk/adoptopenjdk8

# To be able to safely run 'brew cleanup'
brew untap adoptopenjdk/openjdk
brew untap caskroom/versions
brew cleanup

Install Gradle:

brew install gradle

Add Java to path in your .profile/.bash_rc/.zshrc:

export JAVA_HOME=$(/usr/libexec/java_home).

Install yarn

Installing yarn when you want to use NVM seems to be a bit tricky. Easiest way to do it is with Brew, but it requires some tricks.

brew edit yarn

Then comment out the depends_on "node" line since you already will have node installed via NVM and do not want to install Node from Brew.

brew install yarn

And tada, we have Yarn installed with Node from NVM.

Install Bower :(

You'll probably have projects that are still using bower for package management.

npm install bower -g

Install Nodemon

Use Nodemon to run your Node apps. It will reload the app on code changes. Pure developer bliss.

npm install nodemon -g

To use Nodemon, you run your app like this:

nodemon myapp.js

Install Go

brew install go

Install Docker

Get it at: https://hub.docker.com/editions/community/docker-ce-desktop-mac/

Dive

A tool for exploring a docker image, layer contents, and discovering ways to shrink the size of your Docker/OCI image.

brew install dive

Install MongoDB

brew install mongodb

Install Nginx

We'll need nginx to setup that complex development environment.

brew install nginx

Instal Redis

Who doesn't have a project that uses Redis for cache or something?

brew install redis

Install watchman

Watchman is a supposedly smart file change watcher written by the people over at Facebook used by live reload helpers.

brew install watchman

Install phantomjs

Phantomjs is a headless WebKit scriptable with a JavaScript API. Often used for running tests.

brew install phantomjs

Various unix libs & tools

To install some of the Unix libraries and tools often needed, copy & paste the following to your terminal and hope for the best.

brew install wget libpng ffmpeg graphicsmagick imagemagick jpeg lame xz
brew install sox --with-lame

Make it look pretty

Getting consistent themes across different apps used to be tough.. but nowadays it's getting better. Let's install Dracula!

Get it at: https://draculatheme.com/

Install the apps

Alfred

One app to rule them all. Alfred is used for quickly launching shit and controlling your mac like a boss. I used to use Quicksilver, but Alfred is way better nowadays.

Get it at http://www.alfredapp.com/ and don't be afraid to put down some cash to get the power pack. Worth every penny.

ps. Remember to set up the clipboard history extension. That really is a lifechanger, when you no longer have to jump between files to copy paste and instead you can copy multiple entries and then access them from the clipboard history with handy keyboard shortcuts.

Great Alfred workflows

Choosy

As a web dev you are using many browser. With Choosy you can open links in the correct browser. Set Choosy as the default browser and it let's you pick which browser to open. Or configure complex rules that decide which browser gets used to open a specific link.

Get Choosy at: https://www.choosyosx.com/

CreativeSuite

Love-hate -relationship here. Can't live without.

Get it at: http://www.adobe.com/creativecloud.html

Dash

Most of the documentation you'll ever need accessible with a fast keyboard shortcut.

Get it at: https://kapeli.com/dash

Dropbox

Dropbox doesn't really need introductions, right? Backup your files and share them with your team and clients. Yay.

Get it at: https://dropbox.com

Fantastical

Fantastical lives in the menubar. It lets you take a quick peek at your calendar and whats next. It also boasts handy natural language processing capabilities for easy input of new calendar events. Also it looks pretty.

Get it at: https://flexibits.com/fantastical

FastDMG

Sometimes opening those .dmg files take forever. Switch to FastDMG for an improved experience with .dmg files.

Get it at: https://sveinbjorn.org/fastdmg

Flux

Makes the color of your computer's display adapt to the time of day, warm at night and like sunlight during the day. Similar to OSX Nightshift, but you need Flux when using an external monitor.

Get it at: https://justgetflux.com/

Onivim2

An approachable way to start with VIM.

Get it at: https://www.onivim.io

Bear

A simple app for writing your thougts down and finding it after wards.

Get it at: https://bear.app/

Spotify

I really can't function without some great tunes being injected into my brain. Get some Shure sound isolating earphones, unhear the world and focus on getting things done.

Get it at: https://spotify.com

Todoist

I've been trough Things, OmniFocus, Wunderlist and a couple more I've already forgotten. The current favorite is Todoist. They keep improving stuff. Plus my Karma level is Enlightened.

Get it at: https://todoist.com

LittleSnitch

Every self-respecting nerd needs to be able to decide which apps can call home and which can not. It's interesting to see where all those apps are reporting your actions.

Get it at: http://www.obdev.at/products/littlesnitch

Sketch

The "Photoshop killer". For quick user interface design, you rarely need to open Photoshop these days. Sketch does the job faster.

Get it at: http://bohemiancoding.com/sketch/

Pock

Display macOS Dock in Touch Bar. And some other cool widgets too. Free and open source.

Get it at: https://pock.dev/

Transmit

Transmit is the (s)FTP app of choice. Favorites syncing via Dropbox is quite nifty.

Get it at: http://panic.com/transmit/

ps. When you thought you lost that edit to a file, check Transmit temporary files cd ~/Library/Caches/Transmit/.

Keka

Sometimes someone ends up sending you that rare .rar or .7zip package and you really want to find out what's inside. Keka does this for you.

Get it at: https://www.keka.io/en/

Iterm2

The best terminal for OS X. And get the nightly build. Using drag and drop on your terminal to upload files to a remote ssh host is next-level stuff.

Get it at: https://www.iterm2.com/

ImageOptim

Makes your images great again. Removes bloated metadata. Saves disk space & bandwidth by compressing images without losing quality.

Get it at: https://imageoptim.com/mac

Sequel Pro

A nice GUI to peek around MySQL databases.

Get it at: http://www.sequelpro.com/

Keycastr

Keycastr is an open-source keystroke visualizer. It makes it super easy to show your keystrokes in videos.

Get it at: https://github.com/keycastr/keycastr

Rescue time

It's great to track what you're spending your time on. Understanding how you use your time is a good step towards productivity.

Get it at our referral link: https://www.rescuetime.com/rp/wingmen

Teleport

If you have more than one mac lying around, you can use Teleport to control any number of macs from your main mac. Just set it up on all macs and move the mouse from your screen corner to the next mac to get control of it. You can even drag files between macs this way. Pretty sweet.

Get it at: http://www.abyssoft.com/software/teleport/

Transmission

Some times you need to download those Linux distros you know. That's where Transmission torrent client comes in!

Get it at: http://www.transmissionbt.com/

1Password

Use a safe password and don't need to remember them. They even came out with a nifty team feature, which makes it perfect for sharing passwords with your team.

Get it at: https://1password.com/

Quickres

A little tool to unlock more resolutions for your retina display. Really great when you need more screen space for your laptop.

Get it at: https://www.thnkdev.com/QuickRes/

PoEdit

Nice translations editor for PO files. Especially handy as it can remotely edit WordPress translations.

Get it at: https://poedit.net/

VLC Player

Play all those pesky video files that Quicktime doesn't want to play. You know, the ones that came with the Linux distros.

Get it at: http://www.videolan.org/vlc/index.html

Chrome & Firefox

Let's face it, if you're developing stuff for the web, you need to have all the browser even if there are tools like Browserstack nowadays available. To get the animations smooth, you need to test on the real thing.

Get FF: https://www.mozilla.org/en-US/firefox/new/
Get Chrome: https://www.google.com.sg/chrome/browser/desktop/

Chrome extensions

No browser is perfect out of the box. Let's jazz up that browser a bit.

Ublock Origin - Goodbye adds, trackers and slow pages.

Ember Inspector - Inspect why your Ember app is grumpy.

React Devtools - See what's up with your react apps.

Mortality - Don't get distracted by tempting sites on your new page tab and be reminded you only have so much time left in this life.

Tabagotchi - If Mortality is a bit too much, this is another great and fun new page addon to keep your tabs under control.

Personal Blocklist - No more results from w3schools, ha!

Finder & Spotlight & other tips

Next, let's configure the finder and spotlight to behave in a saner manner.

By default, you can't change the selected option on a dialog in, which sucks a lot. It makes no sense to reach for that mouse to just confirm or cancel some action. From the keyboard settings, you can make all controls in dialogs navigable with tab and shift + tab. Here's how:

  1. Open System Preferences
  2. Open Keyboard settings
  3. Open Shortcuts -tab
  4. At the bottom of the dialog choose Use keyboard navigation to move focus between controls

Hide and show menu bar & dock automatically

This is a life changer for laptop work as it gives you more screen estate to work with. It also gives you superior focus, when all the distractions (red dots on app icons) aren't visible until you actually want to see them.

To hide the menu bar, go to System Preferences -> General and check "Automatically hide and show the menu bar". For added hacker points you can also tick "User dark menu bar and Dock".

To hide the Dock, head to System Preferences -> Dock and check "Automatically hide and show the Dock".

And don't forget to make the hiding and showing nice and snappy by running the following command in the terminal:
defaults write com.apple.dock autohide-time-modifier -int 0; killall Dock

Reduce transparency & motion

Don't like things being that transparent & flying around? Me neither. Also, this might save your processing power for more important tasks.

Go to System Preferences -> Accessibility -> Display and check "Reduce Motion" and "Reduce Transparency".

Some further tweaks to speed up things are:

Disable application launch animation

defaults write com.apple.dock launchanim -bool false; killall Dock

Disable QuickLook animation

defaults write -g QLPanelAnimationDuration -float 0; killall Dock

Disable Launchpad animation

defaults write com.apple.dock springboard-show-duration -int 0
defaults write com.apple.dock springboard-hide-duration -int 0; killall Dock

Show path for spotlight search files

Somewhere in Lion or Mavericks they decided you don't need to know where the files you search for are residing and stopped showing file paths for search results. That sucks. Lucky you can get a peek at the path by holding down CMD while looking at the results.

Show library folder

Again they hide things from you. Steps to get your precious library folder back:

  1. Open your home folder in Finder
  2. Press CMD + J
  3. Tick "Show Library Folder" in the popup

Show filename extensions

Again hiding stuff. And if you didn't notice, I hate when they hide things. To make filename extensions visible:

  1. Open Finder
  2. Press CMD + ,
  3. Tick "Show all filename extensions" in the popup

Kill Smart Quotes

If you're a programmer and copy-paste snippets of code around, the smart quotes feature is bound to screw you. For example, I store code snippets in Evernote. Whenever pasting in code with quotes, OS X "fixes" them up for me - usually breaking the code.

Luckily it's easy to disable:

  1. System Preferences
  2. Language and Region
  3. Keyboard preferences
  4. Text
  5. Uncheck "use smart quotes"
  6. PEACE

Cycle open windows with ALT + TAB

By default, it's hard to jump between the different windows of an app. At least on Finnish keyboard as CMD + ` is not easy to reach. Setting ALT + TAB to cycle windows is way more intuitive.

  1. Open Preferences
  2. Open Keyboard preferences and the Shortcuts tab inside
  3. Under Keyboard section on the left change the shortcut for "Move focus to next window" into ALT + TAB

Random tips & tricks

Open iTerm2 in current finder folder

Create a service using the guide located here and then add a keyboard shortcut like CMD + Shift + I to launch the service. That's a really fast way to get into the terminal in the current folder.

Quickly open a specific folder in finder

When in finder press CMD + Shift + g to open "Go to folder" prompt which allows you to quickly enter a path to open.

Open Finder from the terminal in the working directory

Type in open . and hit ENTER. This opens the current directory in finder - super handy. You can also open files like this.

Put Caps Lock to better use

When have you last used Caps Lock key? Yep, I know. Lets put it to use and remap it to something useful like ESC. Think about the hundreds of kilometers of pinky movement saved when using Vim.

  1. Get Karabiner-Elements and install it
  2. In the app Change Caps Lock keycode to 53
  3. Now your Caps Lock acts as ESC

Android USB tethering for your Mac

I don't really understand how can you need a separate driver for this, but you can get it here.

Xcode Wireless Debugging — Run builds over WiFi

This is a lifesaver tip. You can run your app builds on your phone even if you forgot that pesky, expensive cable under the table in that fancy coffee you had one too many lattes at.

  1. Connect your phone to your mac via the USB and fire up Xcode
  2. Press Shift + Command + 2 to open devices manager and select your phone
  3. Check the Connect via network checkbox and trash that USB cable you don't need no more
  4. Profit

Fix AirPlay connectivity issues

Often AirPlay just stops connecting to the speakers. I've had this happen with pretty much all of my Macs - gone are the days when Apple stuff just worked. But lucky for us, as the same little trick still seems to work and get it fixed.

Open your terminal and type in the following command to reboot the coreaudio service and get things running again:

sudo kill -9 `ps ax|grep 'coreaudio[a-z]' |awk '{print $1}'`

More fine-grained volume control

You can have more fine-grained control over the volume if you hold down ALT and SHIFT when adjusting the volume up or down with the quick keys.

Quickly access program preferences

Just hitting CMD + , opens the preferences in most OSX apps.

Paste rich text as plain

Often you copy text from a web page and drop it to Evernote or Pages and the styles from the web page are preserved. Annoying! But use CMD + SHIFT + v to paste your text. Et voilà, plain text!

Take screenshots like a boss

Hit CMD + Shift + 4 to paint an area which you want for a screenshot. Paint, click and your screenshot will be saved on the desktop.

Take screenrecordings like a boss

Hit CMD + Shift + 5 to be able to select the area of the screen you want to record. To start recording click the Record button in the menu that popped up. To stop the recording hit CMD + CTRL + ESC.

Under the options from the popup menu you can choose some useful stuff like showing mouse clicks as in the video.

Accessing photos on iPhone

Scratch using any third-party apps or even the complex Photos app and use an app called Image Capture that comes with OS X.

Convert .p12 file to .key file

Mac OS X Keychain allows you only to export your private keys as .p12 or .pem files. Sometimes you want to have the .key file. You can use OpenSSL to convert between the formats. Use the command below and give it the import password when it asks.

openssl pkcs12 -in myverysecretprivatekey.p12 -nodes -out mynomoresosecretprivate.key -nocerts

Create a password protected zip

While the context menu allows you to easily zip files on the fly, it does not allow you to password protect that zip file. So when you have some dark secrets to hide and need to send em over in zip, here's how you can do it on the command line.

zip -e -r darksecrets.zip darksecretsdirectory

Terminal to clipboard

In the terminal you can use two commands pbcopy and pbpaste to interact with the system clipboard. They work as you would expect unix programs to work. For example, copying website source to the clipboard is as simple as:

curl "http://stackoverflow.com/" | pbcopy

Killer shortcuts in Finder

Some less known shortcuts that you should be using to make using the finder less painful.

  • CMD + Shift + A - Open Applications folder
  • CMD + Shift + H - Open Home folder
  • CMD + Shift + D - Open Desktop folder
  • CMD + Shift + O - Open Documents folder
  • CMD + Option + L - Open Downloads folder
  • CMD + Shift + L - Open Library folder
  • CMD + Shift + . - Toggle Hidden Files
  • CMD + [ - Back
  • CMD + ] - Forward
  • CMD + Up - Up

Sync a local folder with Dropbox

You can use symlinks to sync local folders to dropbox. For example add a symlink for ~/Desktop folder to ~/Dropbox/Desktop to sync your desktop to Dropbox. This is assuming that ~/Dropbox is your Dropbox folder.

ln -s ~/Desktop ~/Dropbox/Desktop

List all lisences in a JavaScript project

Sometimes you work with that annoying Large ACME Inc and they request you to provide all the lisences you are using to run that service for them. And boy are there a bunch of those to find by hand - Yarn can save your bum here.

yarn licenses list

Find open files by process name

Ever needed to figure out what files is a given process touching? This command let's you snoop around.

sudo opensnoop -n ProcessName

Solve random Iterm tab open slowdown

No idea why but clearing some logs helps make iTerm fast again.

sudo rm /private/var/log/asl/*.asl