Have you tried using "brew unlink openssl@3" before the install? After the install, you can use "brew link openssl@3". This assumes that you have Homebrew installed. See
Homebrew The Missing Package Manager for macOS (or Linux). Though some of your error messages also suggest that you have the wrong machine architecture version installed.