Setting up your MacBook for software development (2024)

Bex W
6 min readMar 27, 2024

--

If you’re a developer who prefers a no-frills approach, this guide is for you.

Before you start, make sure your MacBook is running the latest operating system — I’m on macOS Sonoma14.1 on a M3 Pro.

Summary

  • Personal preferences: Customise your browser, password management, and keyboard settings.
  • Development tools: Install Homebrew, Git, and Visual Studio Code for coding workflows.
  • Terminal Enhancements: Enhance terminal experience with iterm2, ohmyzsh, syntax highlighting, and suggestions.
  • GitHub access setup: Set up SSH key authentication for secure GitHub interaction in .
  • Managing project dependencies: Install package managers and Docker.
  • Utilising macOS features: Organise screenshots and screen recordings on macOS for a clutter-free workspace.

1. Personal preferences

  • Browser: Install Chrome and set it as your default browser. Chrome offers extra web development tools and a wide range of extensions, making it my browser of choice.
  • 1Password: Manage passwords securely across platforms using just one master password or fingerprint authentication. Enable the Chrome extension for easy logins and browsing. If you’re migrating from one laptop to another, just ensure you have your email, master password, and secret key (you can easily find the secret key by selecting “Find your Secret Key” on the login screen).
  • Keyboard settings: Navigate to system settings > keyboard and set a short delay until repeat (initial delay) and a fast key repeat rate. Waiting a second between each character backspace is nobody’s idea of fun.
  • Rectangle: This tool allows you to move and resize windows in macOS using keyboard shortcuts or snap areas. You can install it via Chrome or Homebrew, which we’ll cover later in this guide (brew install --cask rectangle). Once you start using it, you'll wonder how you ever lived without it. It's a real game-changer for productivity.
Rectangle: Window resizing using keyboard shortcuts

2. Development tools

Homebrew

Homebrew is a package manager for macOS that simplifies software installation, enabling direct installation and management from the command line and automating dependency handling. Run the following command in Terminal (this may take a while):

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

Then, add Homebrew to your PATH as instructed in the output logs:

(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/[username]/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

Git

Git is an essential tool for version control and collaboration in software development. Check if Git is installed by running git --version in the terminal, and if not, install it via Homebrew:

brew install git

Code editor

Visual Studio Code (VSCode) is a popular code editor with a rich ecosystem of extensions. Install it via Homebrew:

brew install --cask visual-studio-code

Configure your auto-save preferences (after delay) and set tab size (2) by pressing Command + Shift + P and navigating to Preferences: Open Settings.

Command + Shift + P

My Go-to extensions:

  • GitHub Copilot (AI Pair Programmer): This tool is a game-changer. It provides contextualised suggestions, making coding more efficient. It’s worth noting that this is a paid service. Additionally, if you’re using it, make sure to navigate to Copilot on GitHub and uncheck Allow GitHub to use my code snippets for product improvements.
Copilot security
  • GitLens: If you’re working in a team or dealing with legacy code, this extension is a lifesaver. It enhances Git functionality by providing features like git blame, which allows you to track changes and easily navigate to GitHub commits and pull requests.
GitLens in VSCode

3. Terminal enhancements

iTerm2 & Oh My Zsh with syntax highlighting and autosuggestions

iTerm2

iTerm2 serves as an upgraded alternative to the default Terminal application, offering a range of features including split panes, search functionality, and more. Install it via Homebrew:

brew install --cask iterm2

We’ll be using iTerm2 for the remainder of the setup.

Oh My Zsh

macOS uses the Zsh shell by default, known for its interactivity and customisation. Oh My Zsh, a community-driven framework, simplifies Zsh configuration management, enhancing both functionality and appearance. Install it with the command:

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

Customise your Zsh experience by enabling syntax highlighting and autosuggestions:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Open your .zshrc file and add the following line to enable plugins:

plugins=(git zsh-autosuggestions zsh-syntax-highlighting)

Additionally, enhance productivity by defining aliases for commonly used commands in your .zshrc file. For example:

# Aliases
alias reload="source ~/.zshrc"
alias ga="git add"
alias gc="git commit"
alias gs="git status"
alias go="git checkout"
alias gp="git pull"
alias gf="git fetch"

Apply the changes by running:

source ~/.zshrc

This command reloads the Zsh configuration, ensuring that any modifications you’ve made take effect immediately. For subsequent changes, you can use the reload alias defined earlier.

4. GitHub access setup

To access your GitHub repositories securely and conveniently from your new laptop, follow these steps to set up SSH key authentication. This method allows you to interact with GitHub without needing to enter your username and password every time. See the GitHub Docs or follow the instructions below to generate a new SSH key and add it to the ssh-agent.

SSH key pair

Generate an SSH key pair using the ssh-keygen command:

ssh-keygen -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "username@email.com"
  • -f ~/.ssh/id_ed25519: Specifies the file where the keys will be saved.
  • -C "username@email.com": Adds an optional comment to the key, usually your email address.

You’ll be prompted to protect your GitHub SSH key with an optional passphrase. You can leave it blank by pressing Return.

Copy the public SSH key to the clipboard:

cat ~/.ssh/id_ed25519.pub | pbcopy

Navigate to Github ( Settings > SSH and GPG keys) and paste the copied key. Name the key to identify your laptop (e.g., “Personal MacBook M3”) and save.

Configure SSH

Create an SSH config file to help manage SSH connections and improve security:

nano ~/.ssh/config

Paste this configuration into the terminal. This ensures that SSH keys are properly managed and used when connecting to GitHub.

Host *
AddKeysToAgent yes
IdentityFile ~/.ssh/id_ed25519

Save and exit the file by pressing control + X and answering Y to save changes.

Configure Git

Configure Git with your GitHub credentials to ensure that your commits are correctly attributed:

git config --global user.name "Your Name"
git config --global user.email "username@email.com"

Verify your setup by cloning a github repository.

5. Managing project dependencies

Ideally, your project should come with its own set of instructions tailored to its specific requirements. In our project, we use rbenv to manage Ruby dependencies and nvm (Node Version Manager) to handle Node.js versions required for JavaScript frameworks.

rbenv

To get started with rbenv, install it via Homebrew:

brew install rbenv ruby-build

After installation, run the following command

rbenv init

Follow the printed instructions (usually involves adding the below to your .zshrc file):

eval "$(rbenv init - zsh)"

Alternatively, you can refer to the latest installation steps provided in the official rbenv documentation.

nvm

To get started with nvm, install it via Homebrew:

brew install nvm

Then, follow the printed instructions (usually involves adding the below to your .zshrc file):

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

Docker

Docker is a containerization tool used to package applications and their dependencies. You can download Docker Desktop from the official website: Docker Desktop.

6. Utilising macOS features

Screenshots and screen recordings

Taking screenshots and screen recordings on a Mac is simple and useful for developers.

  • Screenshots: Press Command + Shift + 4 to capture a selected portion of the screen.
  • Screen Recordings: Press Command + Shift + 5 to open the Screenshot app.

By default, screenshots and recordings are saved to your desktop, but you can easily change the default save location to keep things organised.

  1. Press Command + Shift + 5 to open the Screenshot app.
  2. Select Options.
  3. From the “Save to” section, choose your preferred location (e.g., a folder named “Screenshots” in Documents).

--

--

Bex W
Bex W

Written by Bex W

0 Followers

I’m a backend developer sharing some learnings from my tech journey.

No responses yet