DEV Community

Devang Tomar
Devang Tomar

Posted on • Originally published at Medium on

Setting Up a Mac for Development: A Comprehensive Guide 🧑🏻‍💻 ‍


Photo by Emile Perron on Unsplash

Setting up a new Mac for development can be time-consuming, especially if you’re a developer who needs an efficient and tailored environment. Whether you’re setting up a work machine or a personal computer, having a checklist can save time and effort. Here’s a streamlined guide for getting your MacBook ready for development, optimized for macOS 15 (Sequoia).

Getting Started 🎬

When you turn on your Mac, the setup assistant will guide you through basic configurations like selecting your language, time zone, and Apple ID. Once done, update macOS to ensure you have the latest security patches.

Install Homebrew for App Management ☕️

Homebrew is a must-have package manager for macOS, simplifying the installation of software.

Run the following command to install Homebrew:

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

After installation, ensure it’s updated:

brew update
Enter fullscreen mode Exit fullscreen mode

Installing Essential Applications 📲

Here’s a list of CLI tools and GUI applications you’ll likely need:

Command-Line Tools

Install these using Homebrew:

brew install git
Enter fullscreen mode Exit fullscreen mode

Graphical Applications

Install these with the — cask flag:

brew install - cask \
visual-studio-code \
google-chrome \
firefox \
rectangle \
iterm2 \
docker \
discord \
slack \
spotify \
postgres \
obsidian \
todoist
Enter fullscreen mode Exit fullscreen mode

Note : Do not install Node.js via Homebrew. Use nvm for better version control (details below).

Setting Up the Shell

macOS comes with zsh as the default shell. Enhance it with Oh My Zsh :

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

Add Shortcuts

Edit your ~/.zshrc file to include aliases for convenience. For example:

alias x86="env /usr/bin/arch -x86_64 /bin/zsh - login"
alias arm="env /usr/bin/arch -arm64 /bin/zsh - login"
Enter fullscreen mode Exit fullscreen mode

Custom Brew Packages and Zsh Configuration

To further enhance your development environment, you can reference and use custom configurations from my personal repository.

This repository contains my curated list of brew packages , Zsh plugins , and shortcuts to optimize productivity.

Access the Repository

GitHub - devangtomar/zsh-settings: This repository is dedicated to storing and managing my custom Zsh settings and configurations ⚙️

From the repository, you can:

  • Get a list of Homebrew packages I frequently use.
  • Import my custom ~/.zshrc settings to streamline your shell experience.

Clone the repository to your local machine:

git clone https://github.com/devangtomar/zsh-settings.git
Enter fullscreen mode Exit fullscreen mode

Navigate to the directory and explore the setup:

cd zsh-settings
Enter fullscreen mode Exit fullscreen mode

Feel free to fork or adapt the configurations to match your workflow!

Configuring Git

Set up your Git global configuration:

touch ~/.gitconfig
Enter fullscreen mode Exit fullscreen mode

Add the following content to customize Git commands:

[user]
  name = Your Name
  email = your_email@example.com
[github]
  user = username
[alias]
  a = add
  cm = commit -m
  s = status
  p = push
  co = checkout
  fp = fetch --prune --all
  l = log --oneline --decorate --graph
[push]
 autoSetupRemote = true
Enter fullscreen mode Exit fullscreen mode

With the above aliases, I can run git s instead of git status, for example. It will also automatically set up your remote, so you can do git push on a branch without specifying the upstream origin.

Generate SSH Keys

Create an SSH key for authentication, Start ssh-agent and adding the key:

ssh-keygen -t ed25519 -C "your_email@example.com"
eval "$(ssh-agent -s)"
ssh-add - apple-use-keychain ~/.ssh/id_ed25519
Enter fullscreen mode Exit fullscreen mode

For easier management, create an SSH config file (~/.ssh/config):

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519

Host myssh
  HostName example.com
  User user
  IdentityFile ~/.ssh/key.pem
Enter fullscreen mode Exit fullscreen mode

Now just run the alias to connect.

ssh myssh
Enter fullscreen mode Exit fullscreen mode

Tuning macOS Settings

To improve productivity, adjust these macOS settings:

Sidebar

To get the Home folder in the finder, press CMD + SHIFT + H and drag the home folder to the sidebar.

General

  • Make Google Chrome default browser

Dock

  • Automatically hide and show Dock
  • Show indicators for open applications

Keyboard

  • Key Repeat -> Fast
  • Delay Until Repeat -> Short
  • Disable “Correct spelling automatically”
  • Disable “Capitalize words automatically”
  • Disable “Add period with double-space”
  • Disable “Use smart quotes and dashes”

Security and Privacy

  • Allow apps downloaded from App Store and identified developers
  • Turn FileVault On (makes sure SSD is securely encrypted)

Sharing

  • Change computer name
  • Make sure all file sharing is disabled

Users & Groups

  • Add “Rectangle” to Login items

Defaults

A few more commands to change some defaults.

# Show Library folder
chflags nohidden ~/Library
# Show hidden files
defaults write com.apple.finder AppleShowAllFiles YES
# Show path bar
defaults write com.apple.finder ShowPathbar -bool true
# Show status bar
defaults write com.apple.finder ShowStatusBar -bool true
# Prevent left and right swipe through history in Chrome
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false
Enter fullscreen mode Exit fullscreen mode

Application-Specific Tips

Chrome

Visual Studio Code

Press CMD + SHIFT + P and click "Install code command in PATH".

Now you can use code {file} to open any file in VSCode.

Extensions

Rectangle

  • Full Screen: CMD + SHIFT + ' (prevents messing with other commands)
  • Left Half: CMD + OPTION + LEFT
  • Right Half: CMD + OPTION + RIGHT

iTerm2

For some reason, iTerm2 does not let you use ⌥ + ← and → to tab through words in the terminal by default. I found this article to fix it: Use ⌥← and ⌥→ to jump forwards / backwards

  • Go to Profiles -> Keys:
  • Change ⌥← via "Send Escape Sequence" with b
  • Change ⌥→ via "Send Escape Sequence" with f

Conclusion

This guide is designed to provide a quick, repeatable process for setting up a Mac for development. By automating installations and configuring settings upfront, you can focus on coding and productivity rather than setup hassles.

Connect with Me on Social Media

🐦 Follow me on Twitter: devangtomar7

🔗 Connect with me on LinkedIn: devangtomar

📷 Check out my Instagram: be_ayushmann

Ⓜ️ Checkout my blogs on Medium: Devang Tomar

#️⃣ Checkout my blogs on Hashnode: devangtomar

🧑‍💻 Checkout my blogs on Dev.to: devangtomar

Top comments (0)