Congrats: Your new Apple M1 Chip!
Last updated: 29 Jan 2021
This is as much a note to self as it is a tip to all of you out there using the new Apple M1 chip.
This is also an encouragement to you to buy that new MacBook with the Apple M1 chip, if your current MacBook is also “vintaged” like my MacBook Air (2014) was in May 2020. (Thank you, alab.sg, for informing me that my MacBook is not worth repairing!)
I got my new MacBook Air (2020) on 28 Jan 2021. I transferred my entire environment on the old MacBook Air to the new one via a Time Machine backup.
The migration was, as usual and to be expected, successful without any hiccups. (Yes, I’ll be buying MacBooks like the Apple slave that I am!)
I thought everything will work like before. It didn’t occur to me that my existing environment (all the software I use) must now attempt to run on a new hardware architecture it had never seen before: the Apple M1 chip.
iTerm2 must work first, for me!
I use iTerm2 for one plain and simple reason: it allows me to use the
Cmd key as a
Meta key in
bash. As you might know from my other post on Emacs keybindings on Macbook, I like Emacs keybindings. Coming from Linux that uses the
Alt key right next to the
Space key, I’m not used to over-reaching for the MacBook’s
option key with my left thumb.
(TODO: Write an article on the whole Mac setup that allows Emacs keybindings all over. It’s quite a process, though not complex, to get iTerm2 set up to use
option as the
Meta key. I might not remember to write this article, since my MacBook environment migration was completely successful such that I don’t have to set up iTerm2 again. Please remind me if you need the guide for iTerm2 setup.)
So I tried firing up iTerm2.
Error: bad CPU type in executable
iTerm2 just mentioned it encountered an error, and didn’t completely fire up.
Terminal.app, which did come up, but every program I tried to run (
bash) threw up an error:
bad CPU type in executable.
That makes sense, since these programs used to run on an Intel Core chip.
After searching Wikipedia for a bit, I found that I needed to get these programs to run via Rosetta 2, a translator that allows programs designed to run on Intel Core chips to also be able to run on Apple M1 chips.
You can still use Bash with Apple M1 chip. You do not need to use the built-in Zsh. You just need to get Rosetta 2 installed.
Installing Rosetta 2
Finder.app, open the
/Applications/ folder, find the program you want to use (eg.
iTerm.app) and right-click on the program file and click on “Get Info” to bring up the program file’s information window. You’ll see 3 checkboxes, the middle of which is what you should tick to bring Rosetta 2 into the picture.
After ticking that checkbox, run the program, and a prompt will appear to ask if you want to install Rosetta 2.
Click “Install”, and Rosetta 2 will be installed.
Rosetta 2 works automatically henceforth
Ticking that Rosetta checkbox only has to be done once, for any program.
Once Rosetta 2 is installed, it will always be invoked automatically for any program that needs it. As Wikipedia’s post on Rosetta 2 puts it:
Subsequent launches of x86–64 programs will execute via translation (Rosetta) automatically.
Indeed, I found this to be true.
So far so good. I haven’t found a need to go back to Linux laptop yet.