
This video is only available to subscribers. Start a subscription today to get access to this and 484 other videos.
Migrating to ZSH
This episode is part of a series: Setting up a New Mac for Development.
1. System Preferences 9 min |
2. Setting Up the Terminal 6 min |
3. Setting Up Dotfiles 7 min |
4. Setting Up iTerm Keyboard Behavior 3 min |
5. Setting Up Git and SSH 8 min |
6. Setting Up a Ruby Development Environment 7 min |
7. Setting up Xcode 4 min |
8. Migrating to ZSH 33 min |
Episode Links
- Moving to zsh – Scripting OS X
- Switching to ZSH
- Powerline Fonts
- 256 Colors - Cheat Sheet - Xterm, HEX, RGB, HSL
- Refining Linux: ZSH Gem #19: Global aliases
Installing zsh
- If you’re on Catalina, it’s already installed to
/bin/zsh
- If you’re on Mojave or earlier, or want the most recent version of zsh:
brew install zsh
You’ll also have to make sure that this shell is blessed to be a user’s shell. Do this by adding the path to the zsh binary to /etc/shells
:
sudo vim /etc/shells
In my case I had to add /usr/local/bin/zsh
to this file.
Then change the shell for your user account:/Users/ben/.zshrc
chsh -s /path/to/shell
zsh Features
Some of these have to be enabled before working, but this is a general overview of some of zsh's features.
- Directory completion:
cd D<tab>
. Pressing tab multiple times will loop through the available matches. Press enter to select. - Path expansion:
cd /us/lo/bi<tab>
expands to/usr/local/bin
automatically. - AutoCD:
Desktop
will cd intoDesktop
...
will cd back up one level. I used to use a bash alias for this, but now it's builtin. - Right side prompts
- Global aliases - apply aliases anywhere in a command
- Suffix aliases - match on a suffix. Automatically open
.txt
files with a text editor, for instance. - which will show you aliases & functions in zsh. Super handy when you want to know what a command does, even if it's an alias.
Installing oh-my-zsh
This is a swiss-army knife of configuration. Only install this if you're comfortable and don't mind learning someone else's configuration.
Follow the instructions here to install & configure oh-my-zsh.