How to Update PHP Version on MAC

Profile picture for user devraj

Method 1: Mac Brew PHP Update

Step 1: Update Brew

$ brew update

Step 2: Check the latest version from here and type below command with your latest version

$ brew install php@8.0

Step 3: Add PHP to your path

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

Step 4: Check PHP by typing either of below command

$ php -v
$ php --version
Tags