Transform Your macOS Terminal with iTerm2, oh‑my‑zsh, and Custom Themes
This step‑by‑step guide shows how to install iTerm2, set up oh‑my‑zsh, import attractive color schemes, switch to the agnoster theme, configure Powerline fonts, and enable hot‑keys and useful shortcuts for a more powerful and visually appealing terminal experience.
Effect
Below is the author’s preferred terminal appearance, demonstrating a visually appealing theme; many other color schemes and themes are also available.
iTerm2
iTerm2 is a more powerful replacement for the default macOS Terminal.
item2: https://www.iterm2.com/
After installation, the window looks similar to the default Terminal, but with a black background.
oh‑my‑zsh
Installing oh‑my‑zsh actually installs the Zsh shell, which provides attractive themes (default is robbyrussell).
Run the following command to install:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"After installation the terminal changes appearance.
Color Scheme
Clone the color‑scheme repository or download the zip: git clone Repository: https://github.com/mbadolato/iTerm2-Color-Schemes
In iTerm2 open Preferences ( cmd + ,) → Profile → Colors → Color Presets → Import and select a scheme (e.g., Atom).
After importing, choose Atom to apply.
Theme
Set the Zsh theme to agnoster by editing .zshrc:
# Open .zshrc file
vim ~/.zshrcChange ZSH_THEME to agnoster and save ( :wq).
Reload Zsh ( zsh) or restart iTerm2; the theme changes but may show garbled characters.
Install Powerline fonts to fix the issue:
# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean‑up
tcd ..
rm -rf fontsThen select a Powerline‑compatible font in iTerm2 (Preferences → Profile → Text → Change Font), e.g., Roboto Mono for Powerline.
More Convenient Layout
Disable the native full‑screen option (General → Window → Native Full Screen Windows) and set the window style to Full‑Width Top of Screen (Profile → Window → Style).
After restarting iTerm2, the terminal appears at the top of the screen; press cmd + enter to toggle full‑screen.
Hot Key
Configure a global hot‑key (e.g., option + i) in Preferences → Keys → Hotkey to quickly show or hide iTerm2.
Shortcut Keys
Useful shortcuts include: cmd + enter: toggle iTerm2 size Hotkey: show/hide iTerm2 cmd + d: split pane vertically cmd + D: split pane horizontally cmd + t: open new tab control + u: clear current input control + a: move cursor to line start control + e: move cursor to line end control + b: move cursor backward control + f: move cursor forward cmd + 1,2,3,4: switch tabs option + 1,2,3,4: switch split panes
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Tencent IMWeb Frontend Team
IMWeb Frontend Community gathering frontend development enthusiasts. Follow us for refined live courses by top experts, cutting‑edge technical posts, and to sharpen your frontend skills.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
