If you are using an Apple Silicon Mac, then consider using UTM instead which utilizes QEMU and provides a nice GUI interface. Much nicer than dealing with either Mac Ports or Homebrew and is less disruptive to macOS. Homebrew has been known to cause some configuration issues with macOS, I am not familiar with Mac Ports (always avoided it in the past since I wanted to avoid issues and I usually only use Homebrew on test systems and not my main Mac for similar reasons).
Definitely agree with @VikingOSX on using a traditional VM if this is for an Intel Mac.