This script, made in 2021, builds DOSBox for macOS from source. It seems to work correctly under macOS Sequoia in 2025, but may or may not work in future macOS versions.
Feel free to update the script with current versions of the libraries that it offers to download.