diff --git a/scripts/install.sh b/scripts/install.sh
index ec46293b82306f2694b6ce6f8315d1c92c7cc561..b4d96e3cea3757ee8e3f1da0ae311f843a61c7ce 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -1,5 +1,7 @@
 #!/usr/bin/env bash
 
+[ -d "`pwd`" ] || cd
+
 if [ -z "$BIN_DIR" ]; then
   BIN_DIR=~/.local/bin
 fi
@@ -31,16 +33,19 @@ if ! command -v curl 1>/dev/null 2>&1; then
   echo "Command curl required; aborting"
 else
 
-if [ "`uname`" = "Darwin" ]; then
-  # macOS
-  if ! command -v brew 1>/dev/null 2>&1; then
-    echo "Installing Homebrew; admin rights will be requested"
-    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
+check_brew() {
+  if [ "`uname`" = "Darwin" ]; then
+    # macOS
+    if ! command -v brew 1>/dev/null 2>&1; then
+      echo "Installing Homebrew; admin rights will be requested"
+      /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
+    fi
   fi
-fi
+}
 
 if ! command -v realpath 1>/dev/null 2>&1; then
   # macOS
+  check_brew
   if command -v brew 1>/dev/null 2>&1; then
     brew install coreutils
   fi
@@ -71,11 +76,14 @@ if [ -n "$WITH_DEFAULT_BACKEND" ]; then
   if ! command -v python3.8 1>/dev/null 2>&1; then
     if command -v pyenv 1>/dev/null 2>&1; then
       pyenv install 3.8
-    elif command -v brew 1>/dev/null 2>&1; then
-      brew install python@3.8
     else
-      echo "WARNING: command python3.8 not found"
-      echo "if under Ubuntu, consider running: sudo apt install python3.8 python3.8-venv"
+      check_brew
+      if command -v brew 1>/dev/null 2>&1; then
+        brew install python@3.8
+      else
+        echo "WARNING: command python3.8 not found"
+        echo "if under Ubuntu, consider running: sudo apt install python3.8 python3.8-venv"
+      fi
     fi
   fi
   if ! command -v poetry 1>/dev/null 2>&1; then