Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Ricardo Lobo ricardo-lobo

🎯
Focusing
View GitHub Profile
@ricardo-lobo
ricardo-lobo / sphp.sh
Last active Nov 25, 2021 — forked from rhukster/sphp.sh
Easy Brew PHP version switching
View sphp.sh
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
osx_major_version=$(sw_vers -productVersion | cut -d. -f1)
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2)
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3)
osx_patch_version=${osx_patch_version:-0}
osx_version=$((${osx_major_version} * 10000 + ${osx_minor_version} * 100 + ${osx_patch_version}))
homebrew_path=$(brew --prefix)
brew_prefix=$(brew --prefix | sed 's#/#\\\/#g')