macbook setup guide for fullstack developer

Senior Principal Engineer
··6 min read
macbook setup guide for fullstack developer

macbook setup guide for fullstack developer

Recommendation: Use zsh as your default shell for a smoother experience.

1. Iterm2

Replace your default terminal with iTerm2—a modern terminal with advanced features.

Download iTerm2

Settings Update

Enable natural text editing:

Settings > Profiles > Keys > Key Mappings > Presets... > Natural Text Editing

2. Homebrew

Homebrew is a package manager for macOS that simplifies installing software and libraries.

Install Homebrew by running:

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

3. Git

Git is essential for version control in software development.

Install Git using Homebrew:

brew install git

3.1 ssh key

Set up SSH keys for secure access to Git repositories.

# Generate a new SSH key:
ssh-keygen -t ed25519 -C "[email protected]"

# Check your keys:
ls ~/.ssh

Copy the public key:

cat ~/.ssh/id_ed25519.pub

Add it to your GitHub account here.

3.2 .gitconfig

Update your ~/.gitconfig file:

[url "[email protected]:"]
	insteadOf = https://gitlab.com/
[url "[email protected]:"]
	insteadOf = https://github.com/
[user]
	name = Your Name
	email = [email protected]

4. oh-my-zsh

Supercharge your shell with Oh My Zsh!

Oh My Zsh provides themes and plugins to enhance your terminal experience.

Install it with:

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

5. asdf

Manage multiple runtime versions with asdf.

asdf simplifies managing different versions of programming languages and tools.

Recommend using the official git method

Install asdf:

git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.15.0

Add this to ~/.zshrc:

. "$HOME/.asdf/asdf.sh"

6. nodejs

Install Node.js using asdf:

# install plugin nodejs
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git

# list installed plugin
asdf plugin list

# Install a Version
asdf install nodejs nodejs

# Set a Version
asdf global nodejs nodejs

# check current nodejs version
node -v

Install global npm packages

npm install -g yarn pnpm

Add this to ~/.zshrc:

export NODE_PATH=$(npm root -g)

7. Pyenv

Manage Python versions seamlessly.

Pyenv helps you install and switch between Python versions easily.

Install Pyenv:

# Update homebrew and install pyenv
brew update
brew install pyenv

Update your shell environment:

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init - zsh)"' >> ~/.zshrc
source ~/.zshrc

Install Python:

pyenv install 3.10.4
pyenv global 3.10.4

7.1 venv

A Python virtual environment (venv)

Create and activate a virtual environment to isolate dependencies:

mkdir demo-python && cd  demo-pyton
python -m venv myvenv
source  myvenv/bin/activate

pip usage in venv, eg: install Flask

# install Flask api framework
pip install Flask

Create file hello.py inside /demo-python directory

from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello_world():
    return "<p>Hello, World!</p>"

Serving Flask app hello.py

flask --app hello run

Create file requirements.txt

pip freeze > requirements.txt

8.Java

Java is essential for backend services and enterprise applications.

Download and install your preferred version, Choose macOS > ARM64 DMG Installer:

Update your ~/.zshrc

#export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-23.jdk/Contents/Home
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH

Reload and verify:

source ~/.zshrc
java --version

9.Go

Go is a fast and efficient language widely used for backend development.

Configure Go environment, edit ~/.zshrc, add content below:

# Go private packages
export GOPRIVATE=github.com/Your-Repo
# Go Path
export GOPATH="$HOME/go"
# Go Root Versions
#export GOROOT="$HOME/sdk/go1.23.4"
#export GOROOT="$HOME/sdk/go1.23.0"
export GOROOT="$HOME/sdk/go1.22.10"
export GOBIN="$GOROOT/bin"
export PATH=$GOBIN:$PATH

don't forget to install golang/mock/mockgen

go install github.com/golang/mock/mockgen@latest

# you should see mockgen executable in $GOBIN
ls $GOBIN 

Reload and verify:

source ~/.zshrc
go env
go version

Your code should stored in $GOPATH/src. Go mod package will be stored in $GOPATH/pkg.

10.Kube

Kubernetes is essential for managing containerized applications.

10.1 .kube/config

First create your ~/.kube/config file with format :

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: CERT-DATA
    server: https://host1:port
  name: cluster1
- cluster:
    certificate-authority-data: CERT-DATA
    server: https://host2:port
  name: cluster2
- cluster:
    certificate-authority-data: CERT-DATA
    server: https://host3:port
  name: cluster3
contexts:
- context:
    cluster: cluster1
    namespace: default
    user: me-cluster1-user
  name: me-cluster1-ctx
- context:
    cluster: cluster2
    namespace: default
    user: me-cluster2-user
  name: me-cluster2-ctx
- context:
    cluster: cluster3
    namespace: default
    user: me-cluster3-user
  name: me-cluster3-ctx
current-context: me-cluster1-ctx
kind: Config
preferences: {}
users:
- name: me-cluster1-user
  user:
    client-certificate-data: CERT-DATA
    client-key-data: KEY-DATA
- name: me-cluster2-user
  user:
    client-certificate-data: CERT-DATA
    client-key-data: KEY-DATA
- name: me-cluster3-user
  user:
    client-certificate-data: CERT-DATA
    client-key-data: KEY-DATA

10.2 kubectl

kubectl

Download and set up kubectl:

# Download the latest release
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl"

# Validate the binary (optional)
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl.sha256"

# Make the kubectl binary executable.
chmod +x ./kubectl

# create /usr/local/bin if not exist
sudo mkdir -p /usr/local/bin

# Move the kubectl binary to a file location on your system PATH.
sudo mv ./kubectl /usr/local/bin/kubectl
sudo chown root: /usr/local/bin/kubectl

# Test to ensure the version you installed is up-to-date
kubectl version --client

10.3 zsh-kubectl-prompt

Enhance your shell prompt with cluster info :

cd ~
git clone [email protected]:superbrothers/zsh-kubectl-prompt

Update ~/.zshrc

# kubeinfo
autoload -U colors; colors
source ~/zsh-kubectl-prompt/kubectl.zsh
RPROMPT='%{$fg[green]%}($ZSH_KUBECTL_PROMPT)%{$reset_color%}'
alias k='kubectl'
alias ksn='_f(){k get namespace $1 > /dev/null; if [ $? -eq 1 ]; then return $?; fi;  k config set-context $(k config current-context) --namespace=$1; echo "Namespace: $1"};_f'
alias ksc='_f(){k config get-contexts $1 > /dev/null; if [ $? -eq 1 ]; then return $?; fi;  k config use-context $1; echo "Context: $1"};_f'
#Usage:
#➜  ~ ksn dev1                                                       (dev-context/dev1)
#     Context "dev-context" modified.
#     Namespace: dev1

#➜  ~ ksn ff                                                         (dev-context/dev1)
#     Error from server (NotFound): namespaces "ff" not found
[[ /usr/local/bin/kubectl ]] && source <(kubectl completion zsh)

10.3.1 Switch namespace

Change namespace in current kube contextme-cluster1-ctx namespace default to namespace staging

ksn staging

10.3.2 Switch context

Change namespace in current kube contextme-cluster1-ctx to context me-cluster2-ctx

ksc me-cluster2-ctx

That’s it! With these steps, your MacBook is primed for full-stack development. 🎉