If you’re a developer and you spend a lot of time in the Mac Terminal, it’s worth your time to make some improvements that will increase your productivity and make you feel more bad-ass.
1. Get iTerm
Why? iTerm is better than the Mac Terminal for a couple of reasons including having split pane view, easier search (it highlights all the words), better mouse text selection support, and is overall more customizable.
Download it here: https://www.iterm2.com/version3.html
iTerm 3 is the newest version of iTerm and has a more beautiful flat design. Oh and it supports images and gifs in the terminal!
2. Know your shortcuts
Shortcuts in the terminal makes developing a LOT faster — when you get used to using these you’ll wish they worked on every app.
Existing terminal keyboard shortcuts:
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + R Lets you search through previously used commands
Ctrl + W Delete the word before the cursor
(iTerm only) Move through tabs right: Cmd + → and left: Cmd + ←
(iTerm only) Move through panes next: Cmd + ] and previous: Cmd + [
Setup iTerm’s system-wide hotkey to open window from anywhere:
In iTerm preferences, click on the “Keys” tab. In the bottom left, under “Hotkey”, check “Show/hide iTerm with a system-wide hotkey” and assign the hotkey you’d like to use.
Enable word jump: In iTerm preferences, click on the “Keys” tab, add new Key Mapping.
Keybord shortcut: option + → | Action: Send Escape Sequence | Esc+: f
Keybord shortcut: option + ← | Action: Send Escape Sequence | Esc+: b
3. Upgrade your shell
When you launch the terminal it will always run with a program inside it to communicate with the computer, this is called the shell. On OS X, the default shell is Bash. If your terminal is using Bash you should see -bash or /bin/bash when you type “echo $SHELL” in the terminal.
Zsh is another type of shell for your terminal. Zsh has a ton of cool features -that may seem small but they can really increase your efficiency in the terminal.
- Hit tab repeatedly to cycle through autocomplete options
- Hit tab to use path expansion
- Hit tab to finish a command using substring command history search
- Maintain a shared command history between tabs
- Create custom layouts (keep reading for more on this)
Let’s install it! First, you will need to download Homebrew, which makes downloading new packages on OS X much easier.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install zsh zsh-completions
To get all the great tools zsh has to offer we will be using oh-my-zsh, a nicely packaged zsh framework.
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
Open a new tab and give it a try. If you like it, make zsh your default shell:
chsh -s /bin/zsh
Now try “echo $SHELL” again — you should see -zsh or /bin/zsh.
4. Make your terminal look more “you”
With zsh installed, you may have noticed that your terminal looks a little different. Oh-my-zsh has a ton of themes to choose from here. You can use themes to show information that’s important to you in the terminal like time, git branch, file path, etc.
Once you find a theme that you like, set ZSH_THEME to the name of the theme in your ~/.zshrc.
Customizing your theme further is pretty easy. You can find all the theme files under~/.oh-my-zsh/themes/ — duplicate a theme that you like, rename it, and make any changes.
To add emojis to your command prompt, open up your custom theme file in a text editor and use “alt+command+T” to open up the special character library. Add emojis in the PROMPT line of your custom theme file. Protip: add a space after each emoji so they don’t overlap.
5. Use aliases
Aliases are shortcuts or abbreviations for commands you type in the terminal. They can save you time if you repeatedly use certain long commands.
To set up aliases, create a file ~/.aliases:
Add command shortcuts in ~/.aliases:
If you already use bash aliases, you can easily transfer those over to zsh by coping them over to ~/.aliases.
In ~/.zshrc add:
Bash and zsh can also share the same aliases. In ~/.bashrc add:
if [ -f ~/.aliases ]; then
Oh-my-zsh installs many git aliases. Open up a new tab/window and give your aliases a try.
That’s all for now! Hopefully you learned some cool tricks to make your terminal more effective and beautiful. I’m sure there are more great tips that I missed, let me know in the comments!