updatedb error - mktemp: too few X's in template ‘updatedb’

The reason you hit this is because you have the GNU mktemp as the first item in your path.

You can verify this by running, type -a mktemp. If you don't see /usr/bin/mktemp as the first option then that is likely your issue.

For example I have:

❯ type -a mktemp
mktemp is /usr/local/opt/coreutils/libexec/gnubin/mktemp
mktemp is /usr/bin/mktemp

The reason I hit this is that I have run brew install coreutils, and then followed the option in the caveats section:

Commands also provided by macOS have been installed with the prefix "g".
If you need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH

This can put the GNU mktemp ahead of the macOS one.

The fix is simply to stop doing that, remove the above line and just use the g-prefixed versions (e.g. gmktemp) when you need GNU tools.