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:
<code>sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"</code>After installation the terminal changes appearance.
Color Scheme
Clone the color‑scheme repository or download the zip:
git cloneRepository: 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
Atomto apply.
Theme
Set the Zsh theme to
agnosterby editing
.zshrc:
<code># Open .zshrc file
vim ~/.zshrc</code>Change
ZSH_THEMEto
agnosterand save (
:wq).
Reload Zsh (
zsh) or restart iTerm2; the theme changes but may show garbled characters.
Install Powerline fonts to fix the issue:
<code># clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean‑up
tcd ..
rm -rf fonts</code>Then 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 + enterto 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
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.