Skip to content

Commit 1724a48

Browse files
fix(build): safely append Homebrew paths to avoid overriding user toolchains (#68)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent dc877e9 commit 1724a48

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

build.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
#!/bin/bash
22
set -eo pipefail
33

4-
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
4+
# Safely append Homebrew bins to PATH if they exist, to avoid overriding custom toolchains
5+
if [[ ":$PATH:" != *":/opt/homebrew/bin:"* ]] && [ -d "/opt/homebrew/bin" ]; then
6+
export PATH="$PATH:/opt/homebrew/bin"
7+
fi
8+
if [[ ":$PATH:" != *":/usr/local/bin:"* ]] && [ -d "/usr/local/bin" ]; then
9+
export PATH="$PATH:/usr/local/bin"
10+
fi
511

612
echo "=============================================="
713
echo " SwiftLM Build Script "

0 commit comments

Comments
 (0)