Skip to content

Instantly share code, notes, and snippets.

View ricardo-lobo's full-sized avatar
🎯
Focusing

Ricardo Lobo ricardo-lobo

🎯
Focusing
View GitHub Profile
@ricardo-lobo
ricardo-lobo / sphp.sh
Last active November 25, 2021 11:16 — forked from rhukster/sphp.sh
Easy Brew PHP version switching
#!/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')