sudo update-alternatives --config php // choose the php version you want after that
brew unlink php@7.4 && brew link php@8.1