From bash to zsh on macOS

In anticipation of macOS 10.15 Catalina, I have changed my shell from bash to zsh. macOS 10.15 will use zsh as the new default, and I was pretty sure that things will break immediately unless I prepare – so I did prepare, and I found the transition very simple.

zsh in iTerm2 with the snazzy theme and pure installed

My old bash prompt didn't work out of the box, so getting a decent prompt with some color and git repository information, I managed to set up sindresorhus/pure to offer asynchronous (!) info like the pwd's git metadata.

If you want my setup, install this:

I had to split my old .bash_profile file into an .aliases file that is used by both bash and zsh; similarly, I extracted variable settings (like adjustments to my PATH) into a shared file. Both zsh and bash can "import" other shell files via the source FILENAME program. To split the configuration up and then migrating the old bash stuff this way proved to be very simple and satisfying.

I didn't want to replace the .bash_profile because I want my dotfiles to be compatible with my webserver and other devices where zsh is not installed.

Browse the blog archive