How I upgrade my Mac for development in Catalina macOS
Tags: beginners, ruby, node, webdev
Published: 2019-11-13 11:52:57

---
title: How I upgrade my Mac for development in Catalina macOS
published: true
description:
tags: beginners,ruby,nodejs,webdev
---

My previous post [How I setup my Mac for development](https://dev.to/sakko/how-i-setup-my-mac-for-development-2obp) will work just fine with older macOS.

I also made a video, check it out if you have trouble installing ruby, python, nodejs

[![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bm6p0rqg2a2ndy9szkvf.jpg)](https://www.youtube.com/watch?v=TUMbUeschdg)

But now that it's Catalina, `bash` has been changed to `zsh` and I want to note my setup and other findings here.

Most of the steps are the same except `nvmrc` part

# 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`

```bash
$ pwd
/Users/sakko
```

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

```bash
$ xcode-select --install
```

Then click `install` to continue

# Configure git config

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

```bash
$ 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.

```bash
$ nano ~/.gitignore
```

Then add these

```
# Node
npm-debug.log

# Mac
.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows
Thumbs.db

# WebStorm
.idea/
```

After you are done, activate this globally by running

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

# install iterm2

https://iterm2.com/

# install oh my zsh

fully explained here https://github.com/robbyrussell/oh-my-zsh

but for quick installation just run 

```bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
```

then restart terminal

# Install NVM

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

copy the installation line (eg.)

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

Open `~/.zshrc` 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 you might want to install `nvm-auto` from https://github.com/dijitalmunky/nvm-auto

run this line by line

```bash
cd ~/.oh-my-zsh/custom/plugins
git clone https://github.com/dijitalmunky/nvm-auto.git
sed -e 's/^plugins=(\(.*\))/plugins=(\1 nvm-auto)/' -i .pre-nvm-auto ~/.zshrc
echo 'nvm_auto_switch' >> ~/.zshrc
source ~/.zshrc
```

Restart terminal then install nodejs (only the version you use)

```bash
$ 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.

```bash
$ \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

```bash
$ 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)

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

Then install latest version of Rails

```bash
$ 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

```bash
# image processing
$ brew install imagemagick gs vips

# postgresql or postgresql@11
$ 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.

- https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
- https://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

Agree with the terms or use openjdk from Homebrew

```bash
$ brew tap AdoptOpenJDK/openjdk
$ brew cask install adoptopenjdk8
```

Then install ElasticSearch

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

# Android development + React-Native

The best tutorial is the official one.

https://facebook.github.io/react-native/docs/getting-started

# 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)

```bash
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  ruby-block set-syntax indent-guide-improved
```

# Sublime

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.

```
Babel
Emmet
GitGutter
JsPrettier
JSX
JsFormat
```

Also enable CLI with

```
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

```

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