Switch PHP version on Mac with fish terminal
If you’re using the Fish shell (
/usr/local/bin/fish) on your Mac, you need to source the Fish configuration file to update the environment variables.
Follow these steps:
- Run the following command to open the Fish configuration file in a text editor:
config.fish file doesn’t exist, it will be created.
- In the
config.fishfile, add the following line to set the PHP version to 8.2:
set -x PATH /usr/local/opt/[email protected]/bin $PATH
This line adds the PHP 8.2 binary path to the beginning of the
Save the changes and exit the text editor.
- Now, to apply the changes and update the environment variables, run the following command in the terminal:
This command sources the Fish configuration file, updating the environment variables.
- To verify that the PHP version has been updated to 8.2, run the following command:
The output should display the PHP version as 8.2.x.