Setting up my new Mac today, I found myself once again configuring my development environment. Like many developers, I started my journey with the default macOS terminal thinking, "This works fine." But after discovering the power of a properly configured development environment, it transformed my daily workflow. I decided to document the entire process, hoping it might help others setting up their Mac for development. This guide will help you create a modern, feature-rich terminal environment that will make you more productive and – dare I say it – make terminal work enjoyable.
Time to Complete: 15-20 minutes
Compatibility: Works on both Intel and Apple Silicon Macs
Skill Level: Beginner to Advanced
Quick Start (TL;DR)
For those who just want to get going, here are all the commands in order. If you're new to terminal customization, I recommend following the detailed guide below instead.
Ultra-Quick Setup (for the brave)
# One-liner setup (review the script contents first!)
curl -fsSL https://raw.githubusercontent.com/perezgb/mac-terminal-setup/refs/heads/main/setup.sh | bash
Standard Quick Setup
# 1. Backup existing configuration
cp ~/.zshrc ~/.zshrc.backup 2>/dev/null || echo "No existing ~/.zshrc"
# 2. Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 3. Install iTerm2
brew install --cask iterm2
# 4. Install Oh My Zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# 5. Install Powerlevel10k theme
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
sed -i '' 's/ZSH_THEME="robbyrussell"/ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc
# 6. Install essential plugins
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
brew install autojump
# 7. Restart terminal or reload configuration
source ~/.zshrc
Quick Verification ✓
After running the quick setup, verify everything is working:
# Check Oh My Zsh
echo $ZSH_VERSION
# Check Powerlevel10k
p10k
# Check plugins
echo $plugins
Before We Begin
What You'll Need
- About 15-20 minutes of your time
- Basic familiarity with terminal commands (but don't worry, we'll explain each step)
- A cup of coffee (optional, but recommended ☕)
What You'll Get
- A modern, fast terminal with split-screen capability
- Smart command history search
- Syntax highlighting as you type
- Intelligent directory navigation
- Git status information in your prompt
- Auto-suggestions based on your command history
Backup Strategy
Before we start, let's ensure we can recover if needed:
# Backup existing configurations
cp ~/.zshrc ~/.zshrc.backup 2>/dev/null || echo "No existing ~/.zshrc"
cp ~/.p10k.zsh ~/.p10k.zsh.backup 2>/dev/null || echo "No existing ~/.p10k.zsh"
Installing Homebrew
Homebrew installs the stuff you need that Apple didn’t.
If you haven't installed it yet, run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Note: You might be asked for your password. This is normal – macOS needs your permission to install system-wide tools.
Step 1: Installing and Configuring iTerm2
iTerm2 is a replacement for Terminal and the successor to iTerm. It works on Macs with macOS 10.14 or newer. iTerm2 brings the terminal into the modern age with features you never knew you always wanted.
Installation
brew install --cask iterm2
Initial Setup
After installing iTerm2:
- Open iTerm2 (you can find it in your Applications folder)
- Press
⌘,
(Command + Comma) to open Preferences - Let's make it comfortable to use:
- Go to 'General > Window'
- Check 'Native full screen windows'
- Under 'Profiles > Default':
- Set 'Window Size' to 140x40 (this gives you plenty of space to work)
Step 2: Setting Up Oh My ZSH
Oh My Zsh is a delightful, open source, community-driven framework for managing your Zsh configuration. It comes bundled with thousands of helpful functions, helpers, plugins, themes, and a few things that make you shout...
Installation
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Note: If you see a prompt asking to make zsh your default shell, type 'Y' and press Enter.
Step 3: Installing Powerlevel10k Theme
Why Powerlevel10k?
Powerlevel10k makes your terminal:
- Show helpful information (like git branch and status)
- Look modern and professional
- Feel faster and more responsive
Installation Steps
- Install the theme:
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
- Set up the theme:
# Open your zsh configuration file in TextEdit (if you prefer)
open -e ~/.zshrc
# Or use the terminal to make the change
sed -i '' 's/ZSH_THEME="robbyrussell"/ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc
- Restart iTerm2 or run:
source ~/.zshrc
Configuring Powerlevel10k
When you restart iTerm2, you'll see the Powerlevel10k configuration wizard. The wizard will:
- Check if you have the required fonts
- Help you install them if needed
- Guide you through customizing your prompt
Follow the wizard's recommendations for the best experience. I suggest:
- Yes to all powerline symbols
- Unicode character set (better compatibility)
- Dark color scheme (easier on the eyes)
- Classic prompt style (clean and professional)
- Yes to transient prompt (saves space)
- Yes to instant prompt (faster startup)
If the wizard doesn't start automatically, type p10k configure
and press Enter.
Step 4: Essential Plugins
Let's add three must-have plugins that will make your terminal experience much better:
1. Zsh Autosuggestions
This plugin suggests commands as you type, based on your history:
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
2. Zsh Syntax Highlighting
Makes your commands colorful and helps spot mistakes:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
3. Autojump
Lets you jump to directories by typing j
and part of the directory name:
brew install autojump
Setting Up the Plugins
Open your configuration file:
open -e ~/.zshrc
Find the plugins=
line and update it to:
plugins=(
git # Git shortcuts and features
zsh-autosuggestions # Fish-like autosuggestions
zsh-syntax-highlighting # Fish-like syntax highlighting
autojump # Smart directory jumping
)
Note: You can also edit this file directly in the terminal using nano ~/.zshrc
if you prefer.
Essential Shortcuts You Now Have
After completing the setup, you'll have these powerful shortcuts available:
-
Ctrl + R
: Fuzzy search through command history -
Ctrl + T
: Fuzzy find files in current directory -
j previous_directory
: Jump to previously visited directory -
gs
: Git status (example of Oh My Zsh's git shortcuts) -
Take folder_name
: Create and cd into a directory -
Cmd + D
: Split iTerm2 pane vertically -
Cmd + Shift + D
: Split iTerm2 pane horizontally -
Cmd + ]
/Cmd + [
: Navigate split panes
Troubleshooting FAQ
Q: The Powerlevel10k configuration wizard isn't starting!
A: Runp10k configure
manuallyQ: My prompt looks wrong or has missing symbols!
A: Runp10k configure
and follow the font installation stepsQ: A plugin isn't working!
A: Verify installation and configuration:
ls ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/
# Check .zshrc plugins section
open -e ~/.zshrc
- Q: How do I uninstall everything? A: Run these commands:
# Uninstall Oh My Zsh
uninstall_oh_my_zsh
# Remove iTerm2
brew uninstall --cask iterm2
# Restore original configuration
cp ~/.zshrc.backup ~/.zshrc
Next Steps
Congratulations! You now have a modern, powerful terminal setup.
How's your new terminal looking? Share a screenshot in the comments below! And if you have any questions or run into issues, feel free to ask in the comments.
Top comments (0)