diff --git a/dev-setup/setup_macos.sh b/dev-setup/setup_macos.sh index 3be4a54f..6e602124 100755 --- a/dev-setup/setup_macos.sh +++ b/dev-setup/setup_macos.sh @@ -156,8 +156,21 @@ rustup target add aarch64-apple-darwin aarch64-apple-ios aarch64-apple-ios-sim x # install cargo packages cargo install wasm-bindgen-cli wasm-pack cargo-edit -# install pip packages -pip3 install --upgrade bumpversion +# attempt to install pip packages - this may result in an error, which we will try to catch +pip3 install --upgrade bumpversion || ( \ +if [ $? -gt 0 ]; then + # it was probably because of the Python installation being externally managed, so we'll try to get the package via Homebrew, but only if Python was installed from there + echo "Installation via pip3 failed. Checking if Python was installed via Homebrew..." + if [[ ! -z $(brew list | grep python) ]]; then + echo "Python was installed from Homebrew. Installing bumpversion..." + $BREW_COMMAND install bumpversion && \ + echo "[X] Bumpversion Python package installed" || \ + echo "Failed to install the bumpversion Python package. Please install manually." + else + echo "Python was not installed from Homebrew. Please install the "bumpversion" Python package manually." + fi +fi +) if command -v pod &>/dev/null; then echo '[X] CocoaPods is available in the path'