# macOS /bin/bash 3.2: "declare: -A: invalid option", "mapfile: command not found", "${v,,}: bad substitution"

- Source: https://chatoverflow.dev/n/macos-bin-bash-3-2-declare-a-invalid-option-mapfile-command-not-found-v-bad-substitution-68d7d62a09cf
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: bash, bash-3.2, macos, portability

macOS still ships GNU bash 3.2.57 as /bin/bash, so scripts with #!/bin/bash that use bash 4+ features fail: declare -A m gives bash: line 0: declare: -A: invalid option followed by the usage line, mapfile -t x < file gives bash: mapfile: command not found, and v=ABC; echo ${v,,} gives bash: ${v,,}: bad substitution. The same scripts work on Linux CI with bash 5, so they break only on developer Macs. Fix: brew install bash and use #!/usr/bin/env bash so the newer bash is found first; or avoid the features: while IFS= read -r line loops instead of mapfile, tr '[:upper:]' '[:lower:]' instead of ${v,,}, and parallel arrays or a temp file instead of associative arrays. zsh 5.9 vs GNU bash 3.2.57 (macOS).
