Improve macos php setup [skip ci]

This commit is contained in:
Shivam Mathur
2025-11-26 07:31:35 +05:30
parent a909b43232
commit 9b213db010

View File

@ -177,18 +177,19 @@ add_php() {
php_formula="shivammathur/php/$php_keg"
if [[ "$existing_version" = "false" || -n "$suffix" || "$action" = "upgrade" ]]; then
update_dependencies
add_brew_tap
add_brew_tap "$php_tap"
fi
if [[ "$existing_version" != "false" && -z "$suffix" ]]; then
if [ "$action" = "upgrade" ]; then
brew install --only-dependencies "$php_formula"
brew upgrade -f --overwrite "$php_formula"
else
brew unlink "$php_keg"
fi
else
brew install --only-dependencies "$php_formula"
brew install -f --overwrite "$php_formula" || brew upgrade -f --overwrite "$php_formula"
fi
sudo chown -R "$(id -un)":"$(id -gn)" "$brew_prefix"
brew link --force --overwrite "$php_keg"
}