From 7064de58851f1742a1e1ca8a92f1f3128011084b Mon Sep 17 00:00:00 2001 From: Aseem Shrey Date: Fri, 6 Feb 2026 18:36:26 -0500 Subject: [PATCH] fix(dev): replace bash 4+ associative arrays with plain variables for macOS compatibility The dev-instance-manager.sh script used `declare -A` (associative arrays) which requires bash 4+. macOS ships with bash 3.2 by default, causing `just dev` to fail with "unbound variable" errors. Replace the associative array with plain variables and a case statement to ensure compatibility across all bash versions. Signed-off-by: Aseem Shrey --- scripts/dev-instance-manager.sh | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/scripts/dev-instance-manager.sh b/scripts/dev-instance-manager.sh index 7e1cf001..d86d0f21 100755 --- a/scripts/dev-instance-manager.sh +++ b/scripts/dev-instance-manager.sh @@ -7,11 +7,9 @@ set -euo pipefail # Configuration INSTANCES_DIR=".instances" -# Base port mappings -declare -A BASE_PORTS=( - [FRONTEND]=5173 - [BACKEND]=3211 -) +# Base port mappings (plain variables for bash 3.2 compatibility on macOS) +BASE_PORT_FRONTEND=5173 +BASE_PORT_BACKEND=3211 # Colors for output RED='\033[0;31m' @@ -45,13 +43,17 @@ get_instance_dir() { get_port() { local port_name=$1 local instance=$2 - local base_port="${BASE_PORTS[$port_name]}" - - if [[ -z "$base_port" ]]; then - log_error "Unknown port: $port_name" - return 1 - fi - + local base_port="" + + case "$port_name" in + FRONTEND) base_port=$BASE_PORT_FRONTEND ;; + BACKEND) base_port=$BASE_PORT_BACKEND ;; + *) + log_error "Unknown port: $port_name" + return 1 + ;; + esac + # Port offset: instance N uses base_port + N*100 echo $((base_port + instance * 100)) }