Skip to main content
  1. 📝 Notes/

unable to find zig installation directory: FileNotFound

· 0 ·

If zig refused to build because it is “unable to find zig installation directory”, you need to ensure the lib directory resides at the same relative path as the zig binary.

I played around and wanted to create a container image to streamline my Zig build experience. Doing so, I used the official tarball and copied over the zig binary, put it into /usr/local/bin, and assumed this was going to work. zig version even proved me correct:

$ zig version

However, once I wanted to build, I got this error message:

error: unable to find zig installation directory '/usr/local/bin/zig': FileNotFound

As usual, Zig error messages aren’t that helpful (yet). Only coincidentally, I found an old dump of zigs freenode IRC channel pointing me in the right direction:

21:25 the zig binary needs to stay at the same relative path to the lib dir

So the solution is not only to copy the binary but also the lib directory from the tarball.

Hopefully, this will be picked up by the search engines, so next time someone encounters the issue, it’s a little bit less of a riddle.

Christoph Voigt
Christoph Voigt
A little bit about you