I spend a fair amount of time in terminal emulators, and here is how I get a good experience on macOS. I use iTerm2, Zsh, and a few cool command-line tools.
I am working on macOS, and I prefer the iTerm2 terminal emulator over the macOS Terminal application:
I especially enjoy the ability to split panes horizontally and vertically, as well as the keyboard shortcuts to move around.
I use the minimal theme with the tab bar on top and the status bar in the bottom with a few helper icons like CPU usage and current process. The color theme is Dracula. I like this theme very much also in other tools, notably Visual Studio Code which is my currently preferred editor aside from IntelliJ IDEA for Java projects. I also use the Cascadia font from Microsoft which is my preferred monospace font these days.
Everyone has their preferences for managing dot files.
I am using a simple repository for that, with a bill-of-materials for applications to install automatically: https://github.com/jponge/dotfiles/tree/2019 (the 2019 edition, switch to another branch if you want).
The dot files get sym-linked using GNU Stow. For instance
~/.zshrc points to
There are various environment variables and shell functions that I rely on. They can be found in
~/dotfiles/env, and they get loaded from
~/.bash_profile if you prefer Bash) using a simple for-loop.
Oh My Zsh
There exist several Zsh plugin managers, but if you want something with sensible defaults and batteries included then Oh My Zsh is a no-brainer.
Once you have it installed, you will like open
~/.zshrc and start changing the configuration. It is very likely that you will start with the theme 😉
I personally like the default
robbyrussell, but you can also use a random theme and eventually find something you like better:
Next come the plugins, and this is all about the tools that you need to use on daily basis. Check
~/.oh-my-zsh/plugins/ to see all the plugins that come with Oh My Zsh.
I personally have the following plugins in use, more on them in the next sections:
I’d recommend not having too many plugins in use. You can often replace a plugin with loading a Zsh completion from the tool.
fzf, a command-line fuzzy finder
You will have to install the tool for the corresponding Oh My Zsh plugin to work, so go to https://github.com/junegunn/fzf.
This tool will help your for completions. A lot 😉
This external plugin provides syntax highlighting as you type shell commands, much like the Fish shell would do. This is very useful, especially since you get instant feedback on non-existing commands, etc.
Head over to https://github.com/zsh-users/zsh-syntax-highlighting for installation instructions.
There is another useful plugin for having a Fish-like experience with completion suggestions based on past history.
Go to https://github.com/zsh-users/zsh-autosuggestions for more details.
Misc. useful command-line tools
There are a bunch of command-line tools that I use but that not everyone may know.
- HTTPie is great for doing HTTP requests. It comes with syntax highlighting and sensible ways to pass form fields, JSON data, files, etc. It is much better that
cURLin a development context.
pstreeto list processes as a parent-child tree. This is not installed by default on macOS.
- bat is similar to
cat, except it offers syntax highlighting (and other goodies).
- watchexec is a general-purpose tool to watch files and trigger a command in response to changes.
- dive is a tool for exploring Docker images, and especially see what each layer brings to the filesystem.
- foreman is a tool for running multiple processes. You just specify commands in a
Procfile, and then start them all and check their logs. It is very useful in development when you need to start many processes.
- hub is the GitHub command-line tool for interacting with repositories. It is especially useful for checking out pull-requests.
- plantuml is a fantastic tool for generating all sorts of diagrams from… text.
- jabba is a tool for managing Java virtual machines. It is frequently updated with builds of OpenJDK, Azul Zulu, GraalVM, Amazon Corretto, OpenJ9, etc.
Originally published at https://julien.ponge.org on November 14, 2019.