2

After Mac OS full reinstall I perform php 8.0 install by brew install php. Unfortunately, brew didn't make this version active: php --version report about 7.3 (not recommended version). I cannot unlink this version because it's not installed by brew, so brew link also doesn't have much sense. How to bring latest php to system level and completely forget about php7.3 ?

Valery Bulash
  • 445
  • 4
  • 22
  • 1
    Does this answer your question? [Update PHP to 7.4 macOS Catalina with brew](https://stackoverflow.com/questions/64684713/update-php-to-7-4-macos-catalina-with-brew) – Nico Haase Apr 23 '21 at 07:44
  • Or this? https://stackoverflow.com/questions/20523183/how-to-use-the-php-that-brew-installed – Nico Haase Apr 23 '21 at 07:44
  • Or this? https://stackoverflow.com/questions/41872645/updating-php-version-on-mac/56942162 – Nico Haase Apr 23 '21 at 07:45

1 Answers1

2

You'll need to tell your terminal where to find your new installed php.

export PATH="/usr/local/opt/php@8.0/sbin:$PATH"

And you need to add it to the bash_profile if you want all terminals to keep using your installed version.

echo 'export PATH="/usr/local/opt/php@8.0/sbin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

This is for terminal use only. So not for your web servers.
In the future, when you install other versions, you can update the profile with:

nano ~/.bash_profile
Joeri
  • 2,214
  • 24
  • 24