Zoxide: The Smarter `cd` Command for Faster Terminal Navigation
If you spend time in the terminal, you probably use cd dozens of times a day. It works, but it is slow for deep paths and forces you to remember every directory name.
Zoxide solves this problem by learning where you go most often and letting you jump there with just a few keystrokes. After switching to Zoxide on my Mac, I navigate faster, stay focused (this is me making stuff up), and type less.
Installing Zoxide on macOS
Zoxide works on Linux, macOS, and Windows. On macOS, install it with Homebrew:
brew install zoxide fzf
Then add this line to ~/.zshrc (or ~/.bashrc):
eval "$(zoxide init zsh)"
Reload your shell:
source ~/.zshrc
You now have the z command available.
How Zoxide Works
At first, z behaves just like cd:
z ~/Projects/my-app # jump to directory
z # go home
z - # go back to previous directory
As you use it, Zoxide builds a memory of where you go. Each directory gets a score based on frecency which is a mix of frequency and recency. The more often and more recently you visit, the higher the score.
Instead of typing full paths, you can just type:
z dev used_up
and Zoxide will take you to ~/Downloads/dev/MyProjects/used_up.
Smart Matching Rules
Zoxide’s matching is simple and reliable:
- Case-insensitive: You can type in lowercase
- Order matters:
z dev used_upworks,z used_up devdoes not - Last word must match the last path component
- Highest score wins when there are multiple matches
This means Zoxide gets better every day you use it.
Interactive Search with FZF
Pair Zoxide with FZF to add fuzzy search.
- Run
zito open a searchable list of your most visited directories - Type to filter, then press Enter to jump there
- Or type part of a path, press Space then Tab to trigger fuzzy suggestions
This is ideal when you only remember part of a directory name.
Managing the Zoxide Database
Zoxide keeps its own small database and cleans out old entries automatically. You can manage it manually:
zoxide add <dir>– add or boost a directoryzoxide query <term>– search the database, add-Lto list allzoxide remove <term>– delete unwanted pathszoxide edit– open an interactive editor to adjust or remove entries
Replacing cd with Zoxide
To make Zoxide completely natural, alias cd itself:
eval "$(zoxide init zsh --cmd cd)"
Now every cd you type is powered by Zoxide, and you can use cdi for interactive search.
Why It’s Worth Using
Switching to Zoxide:
- Saves time and keystrokes
- Keeps your hands on the home row
- Reduces mental overhead and hence you do not need to recall long paths
- Adds fuzzy search for those “I can’t quite remember” moments
Final Thoughts
Zoxide is a small tool with a big payoff. Installing it on macOS takes minutes, but it makes navigation faster and less frustrating.
Combine it with FZF, alias it to cd, and you will not want to go back to the default command.