I use docker for all the projects, but the other day I needed to run a composer command in my host machine to install a Drupal distribution which is not compatible with PHP 8.0, so I needed to switch the PHP version. And the steps to do so are:
- Install homebrew: https://docs.brew.sh/Installation
- Install the Brew PHP switcher script, using:
brew install brew-php-switcher
- Switch to the version needed, in this example is 7.4:
brew-php-switcher 7.4
- You will need to install the version of PHP first:
brew install php@7.4
- You will need to install the version of PHP first: