Skip to content
Devansh Mehra

MacOS Setting up a Mac for Development

Macos, Development Environment1 min read

Getting Started


The setup assistant will launch once you turn the computer on. Enter your preferred language, time zone, Apple ID, and so on. The first thing you should do is update macOS to get the latest security updates and patches.

Install HomeBrew


Install the Homebrew package manager. This will allow you to install almost any app from the command line.

1/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Make sure everything is up to date.

1brew upgrade

Install Apps


Shell ProgramsPurpose
gitVersion control
batcat alternative
fzfsearch
exals alternative
tldrman alternative

Here are some the applications I always install (cask flag in Homebrew):

NOTE: Do not install Node.js through Homebrew. Use nvm (below).

ApplicationPurpose
Visual Studio Codetext editor
Google Chromeweb browser
Firefoxweb browser
Rectanglewindow resizing
iTerm2terminal
Dockerdevelopment
Slackcommunication
Discordcommunication
Spotifymusic
Postgresdatabase
Posticodatabase UI
PostmanAPI Tool
NotionNotes
TodoistTodos
1## Shell Programs
2brew install \
3 git \
4 bat \
5 exa \
6 tldr \
7 fzf &&
8
9# GUI programs
10brew install --cask \
11 visual-studio-code \
12 google-chrome \
13 firefox \
14 rectangle \
15 iterm2 \
16 docker \
17 discord \
18 slack \
19 spotify \
20 postgres \
21 postico \
22 bear \
23 todoist \

Shell

Catalina comes with zsh as the default shell. Install Oh My Zsh for sensible defaults.Catalina comes with zsh as the default shell. Install Oh My Zsh for sensible defaults.

1sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Node.js

Use Node Version Manager (nvm) to install Node.js. This allows you to easily switch between Node versions, which is essential.

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

Install

I recommand using LTS

1nvm install --lts

Restart terminal and run the final command.

1nvm use node

Confirm that you are using the latest version of Node and npm.

1node -v && npm -v

update

For later, here's how to update nvm.

1nvm install node --reinstall-packages-from=node

Git

The first thing you should do with Git is set your global configuration.

1touch ~/.gitconfig

Input your config and create some aliases.

1[user]
2 name = Firstname Lastname
3 email = you@example.com
4[github]
5 user = username
6[alias]
7 a = add
8 ca = commit -a
9 cam = commit -am
10 cm = commit -m
11 s = status
12 p = push
13 pom = push origin master
14 puom = pull origin master
15 cob = checkout -b
16 co = checkout
17 fp = fetch --prune --all
18 l = log --oneline --decorate --graph
19 lall = log --oneline --decorate --graph --all
20 ls = log --oneline --decorate --graph --stat
21 lt = log --graph --decorate --pretty=format:'%C(yellow)%h%Creset%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)%an%Creset'

With the above aliases, I can run git s instead of git status, for example. The less I have to type, the happier I am.

SSH

You can generate an SSH key to distribute.

1ssh-keygen -t ed25519 -C "your_email@example.com"

Start ssh-agent.

eval "$(ssh-agent -s)" Add key.

1ssh-add -K ~/.ssh/id_rsa

Config

Simplify the process of SSHing into other boxes with your SSH config file. Create ~/.ssh/config if it does not already exist.

Add the following contents, changing the variables for any hosts that you connect to. Using the below will be the same as running ssh -i ~/.ssh/key.pem user@example.com.

~/.ssh/config

1Host *
2 AddKeysToAgent yes
3 UseKeychain yes
4 IdentityFile ~/.ssh/id_ed25519
5
6Host myssh
7 HostName example.com
8 User user
9 IdentityFile ~/.ssh/key.pem

Now just run the alias to connect.

1ssh myssh

If you liked the write-up, leave your feedback and suggestions :)