Skip to main content

brew changing PHP versions on OSX

Installing PHP on OSX and it installed PHP 8.2.x.  However, for my applications I need to run 8.1.x.  How do you switch the current PHP version?

 

Current version

Check the current PHP version by executing the command

php -v

Response:

OSX brew regular commands

Regular commands for brew

 

Brew update

This updates Homebrew itself.  Keeping Homebrew current with the command brew update.  Note, before running this command, it can take some time (if you haven't run it recently).  It is highly recommended that you run the update before trying to install a package.

brew update

Response

env: php: No such file or directory

In terminal I ran a regular command - compose update.  Something I've completed thousands of times previously.  However, this time I received the following response:

env: php: No such file or directory

 

Install node via Homebrew including npm install: could not symlink error

Step 1: Install Homebrew

Homebrew is the missing package manager for macOS.

As per the Homebrew site, paste the following in a macOS Terminal prompt.

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

This acton will install Homebrew on your OSX.  Using the following command you can check the brew version

$ brew -v

 

Subscribe to homebrew