If you are using rustc from rustup as that page tells you to, you should be using the LLVM version bundled with rustc itself, which doesn't depend on z3. In addition if you use rustup, rustc should be in a subdirectory of ~/.rustup/toolchains, not in /usr/local/opt. How did you actually install rust?
I checked I installed rust with homebrew. I uninstalled it and used https://rustup.rs/ to reinstall rust and I do not get the error anymore. Thank you!