Description
The script setup_identities.sh does not work on macOS because it uses a GNU sed-style regular expression that is not compatible with BSD sed (the default on macOS).
This causes the script to crash during the chain_code replacement step.
Error Log
sed: 1: "s|^([[:space:]]*chain_c ...": \1 not defined in the RE
Root Cause
macOS uses BSD sed, while most Linux systems use GNU sed.
The script relies on features that only work in GNU sed:
• Extended regex groups without -E
• \1 backreference not recognized due to regex mismatch
Example problematic pattern:
sed "s|^([[:space:]]*chain_code:).*|\1 \"$CHAIN_CODE\"|"
This works in GNU sed but fails in BSD sed.
Steps to Reproduce
-
Run the script on macOS: ./setup_identities.sh
-
Script crashes with: sed: 1: "...": \1 not defined in the RE
Environment
OS: macOS (Apple Silicon)
Shell: zsh
sed version: BSD sed