From 61e362add9e1485bec1ab8261d729016850ec270 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 22 Oct 2024 08:11:37 -0400 Subject: [PATCH] mac: arrange for arm64 run on arm64 Makes 9term.app work again (not put you in an x86_64 jail). --- mac/9term.app/Contents/MacOS/9term | 8 ++++++-- mac/Plumb.app/Contents/MacOS/plumb | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/mac/9term.app/Contents/MacOS/9term b/mac/9term.app/Contents/MacOS/9term index b5a46bc89..04eb042c9 100755 --- a/mac/9term.app/Contents/MacOS/9term +++ b/mac/9term.app/Contents/MacOS/9term @@ -3,12 +3,16 @@ fshell=$(finger $(whoami) | sed -n 's/.*Shell: //p' | sed 1q) SHELL=${fshell:-$SHELL} PLAN9=${PLAN9:-/usr/local/plan9} cd $HOME +arch=x86_64 +if arch -arch arm64 date >/dev/null 2>&1; then + arch=arm64 +fi case "$SHELL" in */rc) echo ' if(! ~ $PLAN9/bin $path) path=($path $PLAN9/bin) - $PLAN9/bin/9term -l -W600x800 & + arch -arch '$arch' $PLAN9/bin/9term -l -W600x800 & ' | $SHELL -l exit 0 ;; @@ -24,6 +28,6 @@ if ! [[ :$PATH: =~ :$PLAN9/bin: ]] then PATH=$PATH:$PLAN9/bin fi -$PLAN9/bin/9term -l -W600x800 & +arch -arch $arch $PLAN9/bin/9term -l -W600x800 & exit 0 diff --git a/mac/Plumb.app/Contents/MacOS/plumb b/mac/Plumb.app/Contents/MacOS/plumb index 850ec0e00..b3f153302 100755 --- a/mac/Plumb.app/Contents/MacOS/plumb +++ b/mac/Plumb.app/Contents/MacOS/plumb @@ -3,6 +3,10 @@ if [ -e ~/.bashrc ] ; then . ~/.bashrc fi +arch=x86_64 +if arch -arch arm64 date >/dev/null 2>&1; then + arch=arm64 +fi PLAN9=${PLAN9:-/usr/local/plan9} bin=$PLAN9/bin @@ -10,5 +14,5 @@ IFS=$'\n' for file in $($bin/macargv) do - $bin/macedit "$file" + arch -arch $arch $bin/macedit "$file" done