Skip to content

Commit eaf155d

Browse files
committed
check for rosetta mode in setup.sh
Running in rosetta mode will now trigger setup.sh to use the x86-64 binaries. Fixes #16.
1 parent 96d3eb0 commit eaf155d

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

scripts/setup.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,22 @@ macOS_quarantine_fix () {
3535
done
3636
}
3737

38+
detect_architecture() {
39+
# Detect if running under Rosetta
40+
if [[ "$(sysctl -n sysctl.proc_translated 2>/dev/null)" == "1" ]]; then
41+
echo "x86_64" # Rosetta forces x86_64
42+
else
43+
uname -m # Native architecture
44+
fi
45+
}
46+
3847
if [ ! -e "$SOAR_HOME/pkgIndex.tcl" ]; then
3948
unamestr=$(uname)
4049
if [[ "$unamestr" == 'Linux' ]]; then
4150
linux64_setup
4251
elif [[ "$unamestr" == 'Darwin' ]]; then
43-
if [ "$(uname -m)" == "arm64" ]; then
52+
arch=$(detect_architecture)
53+
if [ "$arch" == "arm64" ]; then
4454
echo_yellow 'First time initialization of Soar for Mac OSX ARM64...'
4555
mv "$SOAR_HOME/mac_ARM64/swt.jar" "$SOAR_HOME/java/"
4656
mv "$SOAR_HOME/mac_ARM64"/* "$SOAR_HOME/"

0 commit comments

Comments
 (0)