3

After moving to Apple Silicon, somehow the Terminal still returns i386 for arch. (Terminal.app info's 'Open using Rosetta' is unchecked). It looks like some setting is preserved from the backup.

One way to work around it is to launch a new shell with the following:

env /usr/bin/arch -arm64 /bin/bash --login

How can I make arm64 the default?

bmike
  • 235,889

2 Answers2

1

It looks like the default login shell was /usr/local/bin/bash.

$ echo $SHELL
/usr/local/bin/bash
✔ ~ 
$ arch
i386

The list of available shells can be checked using:

$ cat /etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/usr/local/bin/bash /bin/bash /bin/csh /bin/dash /bin/ksh /bin/sh /bin/tcsh /bin/zsh

Changed the Login shell to /bin/bash:

$ chsh -s /bin/bash
Changing shell for xxxxx.
Password for xxxxx: 
✔

Switching to /bin/bash as above and relaunching Terminal solved the problem

$ arch
arm64
✔

It is also possible to set the Login shell on the Preferences of the Terminal.app, choosing Shells open with: Command and adding here the desired shell.

  • 2
    You kept Homebrew for your old system didn't you - if so I would delete /usr/local and reinstall Homebrew. It puts Apple Silicon in /opt/homebrew – mmmmmm Apr 05 '23 at 14:59
  • 1
    Thanks @mmmmmm, makes sense. For that there is an uninstall script though here: https://github.com/homebrew/install#uninstall-homebrew As the Homebrew was indeed installed on i386 architecture, first a new shell should be launched though to avoid errors: env arch -x86_64 /bin/bash --login /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" – pharsfalvi Apr 05 '23 at 15:09
  • https://apple.stackexchange.com/questions/410825/apple-silicon-port-all-homebrew-packages-under-usr-local-opt-to-opt-homebrew might help. – nohillside May 05 '23 at 16:44
0

I had precisely the same problem. The wrong default arch (i386) instead of the native (arm64) was causing my brew migration to native arm64 on an M1 MBP to fail with many messages like:

Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!
To rerun under ARM use:
    arch -arm64 brew install ...
To install under x86_64, install homebrew into /usr/local.
Installing pcre has failed!

So, I just changed my shell to /bin/bash, and then finished my homebrew migration. Once I installed the homebrew arm64 version of bash, I updated my shell to /opt/homebrew/bin/bash.

Problem solved.