How I setup my Mac for development.

sakko profile image SaKKo ・4 min read

Every time I get a new Mac or upgrading MacOS, the pain is reinstalling everything.

I had to take notes on what must be done, and google a bunch of stuffs.

So I decided to write this blog for my personal use and hope that it's useful for other people.

There maybe things that you see that I can improve my dev environment. Please comment so I can be a better developer.

NOTE: I just got a new Mac Mini 2018 i5 SSD256GB RAM20GB and I'm on Mojave OS

Check / Set my home folder

I sometime see people use long username in home folder. I usually go with short and easy to remember username. Mine is sakko.

To check, type open terminal and type pwd

$ pwd

If it's not what you like, find a way to change it now before continuing. It will be extremely difficult to change this after a few months.

Install Xcode

Download Xcode from here https://developer.apple.com/download/more/ or the Apple App Store.

Then try creating a single page app iOS project. Run the project to see if it build successfully.

Install Xcode Command Line Tools

Open terminal and type

$ xcode-select --install

Then click install to continue

Configure git config

Open terminal and input these (replace your name and email)

$ git config --global user.name "John Doe"
$ git config --global user.email "john.doe@gmail.com"

Setup global .gitignores

Mac has some annoying files that can be ignored by git. Let's add them.

$ nano ~/.gitignore

Then add these

# Node

# Mac

# Thumbnails

# Files that might appear in the root of a volume

# Directories potentially created on remote AFP share
Network Trash Folder
Temporary Items

# Windows

# WebStorm

After you are done, activate this globally by running

$ git config --global core.excludesfile ~/.gitignore

Install NVM

For nodejs development, open https://github.com/nvm-sh/nvm

copy the installation line (eg.)

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

Open ~/.bash_profile and add source ~/.bashrc to the first line.

Open ~/.bashrc and see if these lines are present. (if not, add it)

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

If you are using .nvmrc in your projects to activate node version like .ruby-version, then also add these into your .bashrc

enter_directory() {
if [[ $PWD == $PREV_PWD ]]; then

if [[ -f ".nvmrc" ]]; then
    nvm use
elif [[ $NVM_DIRTY = true ]]; then
    nvm use default

export PROMPT_COMMAND=enter_directory

Then install nodejs (only the version you use)

$ nvm install 10.16.0
$ nvm install node    # this will install latest

Install Ruby

I'm a Rails developer so I need ruby as well. I choose rvm (like nvm) to manage versions and gemsets.

Simply run the command below and follow what's prompted.

$ \curl -sSL https://get.rvm.io | bash -s stable

When it's done, restart terminal once, to get rvm loaded.

Install ruby, I use 2.5.3 and 2.6.3 at the moment

$ rvm install 2.5.3
$ rvm install 2.6.3

I don't like document to be installed (to save space) so I usually globally ignore it. (Not sure if this is necessary anymore)

$ echo "gem: --no-document" >> ~/.gemrc

Then install latest version of Rails

$ gem install rails

Homebrew, Postgresql, MySql, ElasticSearch, Redis and other apps

RVM will install Homebrew for you, so you don't need to reinstall it.

So let's install other apps

# image processing
$ brew install imagemagick gs vips

# postgresql
$ brew install postgresql
$ brew services start postgresql # to start service

# mysql
$ brew install mysql
$ brew services start mysql # to start service

# redis
$ brew install redis
$ brew services start redis # to start service

# memcached
$ brew install memcached
$ brew services start memcached # to start service

Installing ElasticSearch require Java8 you can download them from here.

Agree with the terms or use openjdk from Homebrew

$ brew tap AdoptOpenJDK/openjdk
$ brew cask install adoptopenjdk8

Then install ElasticSearch

# elasticsearch
$ brew install elasticsearch
$ brew services start elasticsearch # to start service

Android development + React-Native

The best tutorial is the official one.


Other Apps I use

  • Atom.io
  • VSCode
  • Sublime
  • iTerm2
  • Alfred
  • 1Password
  • Little Snitch
  • iStat Menus

Atom packages

I usually start with these packages, (you need to install shell command from atom application menu first)

apm install atom-beautify blame console-log editorconfig emmet es6-javascript language-docker language-javascript-jsx language-plantuml language-vue linter linter-swagger linter-ui-default plantuml-preview prettier-atom rails-snippets react react-es6-snippets ruby-block set-syntax


I usually use Sublime if I want to quickly open some file (especially JSON). Since it's the fastest editor I can find with all the features I need. These are the packages I usually use.


Other stuffs,

Docker - not yet, I'm saving my precious 256GB ssd T____T

python, gcloud, ansible, blah blah blah..... too many to add. Install them later.

Anything I should add?

Posted on Jun 3 '19 by:


markdown guide

I think you can still get by a bit quicker by installing homebrew as soon as possible then using it to install everything else.
You could put everything you want to brew install into one file and then keep it, and your collection of dotfiles, somewhere in the cloud (like github for instance). Then all you need to do is clone the repo and run one script to get everything installed.


Hey, I am also very egar to know this. If you have time can you please write an article about this for us?


There are a few people who've explained how they do it here already, but you could look at these:

Also: I have an install script using GNU Stow on my github which might be helpful. I don't explicitly install any apps there, though.

Homebrew can install a lot of the things that already have Mac installers (like VSCode for example) so compiling a list and running through it in a single install script means you go make a cup of coffee and it just works.


I don’t know how to do that, can you write a blog to explain?


Take a look at brew bundle! When I'm starting up a fresh mac machine, I usually brew bundle dump to get a Brewfile with a list of all the dependencies/apps I have installed. Then copy the Brewfile onto the new machine and brew bundle. It saves a lot of time :)


Here is mine if you are looking for more ideas: msaracevic.github.io/#/Guides . I keep mine a bit simpler and shorter since I don't need that many things.

The one thing I would suggest in your case is to change git config --global user.email "john.doe@gmail.com" to it config --global user.email ":USERNAME@users.noreply.github.com" if you use github only.

It will still match your contributions correctly based on the no-reply address, but it won't include your real email address to in public commits, meaning that all those pesky recruiter automated scraping scripts won't pick you up and bother your on your main email address.


awesome, i din't know this. But I use a lot of bitbucket and gitlab as well, so I think I will config git project by project.


Oh ;-) nice post, thank you for advice

I do same things and write to my blog - all my experience about Mac and it optimization after reinstall OS, because I'm tired of doing the same actions all the time: proinsurer.com.ua/en/tag/Mac

And I can recommend article about ZSH 'A Beautifully Productive Terminal Experience iTerm, Oh-My-Zsh' proinsurer.com.ua/en/blog-en/mac/1...

maybe I help you with iTerm and ZSH


i’m already using iterm but I’m so used to bash. I’m planning to move to zsh but what I need is, “what do I need to know before moving to zsh?”


You need only install it, and nothing need know. I use iTerm with zsh. ZSH for me - only for autocomplete, cool plugins - same double ESC and all you command now magic with 'sudo yourcommands'. I like when zsh show for me git status like that:


zsh is an advance shell for *nix. It has few very good features, Like:

  1. Auto change directory, meaning, if you know the directory name, you can just simple type "cd **/name-of-dir"
  2. You can use tab to navigate the options.
  3. last comand scrolling, like if you type and command for example "vim somefile", you exited the vim, and used some some other commands, and if you want to use the same command again, unlike in bash, which requires to find the history number to execute, in zsh you can simple use vim and up arrow key, it will place you in last executed command.

There are plenty of powerful features. Simple to use, and configure. You can have a view of few of the videos:



oh no.... i hate timemachine


I use Ansible and bash scripts. I'm too lazy to wasting time on reinstalling things 🤓