Today I once again stumbled upon a painful problem of rupa/z which I was Using since forever. The problem is that once you delete a folder, z will try to cd into it, but then it fails:

The directory 'nonxistent' does not exist.

I tried to poke around the GitHub issues and pull-request but did not find something addressing this problem. What is mote frustrating that z it itself does not allow to remove specified path from it's database, only the current working directory, which is unfortunate if such directory does not exist.

The only solutions I found is either recreate the whole path that, cd into it and then run z -x or go into the database file and remove the entry manually. Both methods suck, the tools should help me, not stand me in the way. It was a great tool and it served me well, but it's time had come.

Enter zoxide

Zoxide from ajeetdsouza/zoxide is one of the many modern compatible replacements, this one written in rust, which could for instance make it fast. What I like about it however, that it actively manages it's database and does not try to cd into directory that was a highest ranking match in the past, but was deleted since. It can also import my old z database even with the non-existent entries and takes care of them, meaning the switch is absolutely painless. Here's what I had to do:

fisher remove jethrokuan/z
brew install zoxide
fisher install kidonng/zoxide.fish
zoxide import --from=z /Users/peterbabic/.local/share/z/data

Nothing else was needed. After a few tests via newly available z I found that nothing seemed broken. So I did a final look at the database of zoxide via zi meaning "zoxide interactive" (requires fzf) and decided to bid farewell to last remnants of the z on the system by removing it's old database directory:

rm -rf /Users/peterbabic/.local/share/z

Enjoy!