Skip to content

Shell Setup

macOS uses zsh by default (since Catalina). Check your shell:

Terminal window
echo $SHELL
# or
echo $0
ShellConfig file
zsh (macOS default)~/.zshrc
bash~/.bashrc or ~/.bash_profile

Add the following line at the end of the appropriate file:

Terminal window
export PATH="/opt/php/bin:$PATH"

After saving the file, reload your shell configuration:

Terminal window
# For bash
source ~/.bashrc
# For zsh
source ~/.zshrc

Now you can install PHP:

Terminal window
# Update the package index
phm update
# Install PHP 8.5 with FPM and popular extensions
phm install php8.5-cli php8.5-fpm php8.5-redis php8.5-opcache
# Set as default version
phm use 8.5

Check that everything is set up correctly:

/opt/php/bin/php
which php
php -v
# Should show: PHP 8.5.x