Moving from Intel Mac to M-chip Mac as a developer?
If you have an Intel chip-powered Mac and are planning to switch to Apple Silicon, there is one specific thing to take care of as a developer. The transition might not sound as easy as Apple proposed in the Migration Assistant help page. The problem is not that it doesn’t work. The problem is that it functions perfectly, but only on the surface.
Let me explain.
The Apple Migration Assistant works like a dedicated copy machine that copies almost all the files and settings from an old Mac to a new one. That can include your applications, folders, settings, etc. It is convenient. It is also a trick that Apple removes the fraction to let you buy new systems every year.
This time is a bit different. We are migrating from Intel Mac to M chip Mac. The difference between the two machines is enormous, mainly from the chip architecture.
What is the difference between ARM64 and x86_64?
x86_64, sometimes referred as x64 or AMD64, was developed by Intel. It is based on Complex Instruction Set Computing (CISC) design, which aims for high performance. This also results in less power efficiency. It is typically used in desktops, servers, etc.
ARM64 was developed by ARM Ltd. It is based on a Reduced Instruction Set Computing (RISC) design. This means it uses a smaller set of simpler instructions compared to x86_64. This makes the processors more power-efficient and widely used in smartphones and tablets.
However, the above description of the two chip architectures is not the complete picture. The power of a chip is not entirely defined by the architecture but also by the software. A heavy piece of software optimized on ARM might have higher performance than its variant on x86_64. This is one of the reasons why Apple moved to ARM, resulting in Apple Silicon.
Now, you might ask, as not all software designed for x86_64 is optimized for Apple Silicon. Is it useless? Yes, it is true at the beginning of the transition. With Apple Silicon, an app called Rosetta is shipped with the Mac. It translates the app built only for an Intel processor for use with the new chip. Its aim is to encourage users to continue using their favorite apps while the app developers are still transitioning to the new architecture.
Therefore, when migrating from an Intel Mac to an ARM Mac, all copied apps can run with Rosetta translating in the background. Most of the time, you will not notice any difference as the translation is very efficient.
Until you try to run your code…
You can run the following code in the terminal on your M-chip Mac to see whether your code is still being translated.
$ uname -m
If the output is arm64
then your terminal environment is correct; if the output is x86_64
, then you are still trapped in the old machine’s memory.
The next step is to check Homebrew, the package manager. This output should be on an Intel Mac.
$ which brew
/usr/local/bin/brew
This output means it is on an Apple Silicon Mac.
$ which brew
/opt/homebrew/bin/brew
If your Homebrew was copied over from Intel, it must be reinstalled properly to match the system.
$ brew bundle dump
$ /bin/bash -c "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh>)"
$ /bin/bash -c "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh>)"
$ brew bundle install --file /path/to/Brewfile/brew/dumped/earlier
The steps above create a Brewfile
that contains all packages installed, uninstall itself from usr/local/bin/brew
, install itself in opt/homebrew/bin/brew
, and install all packages back. You can try which brew
again to verify it.
Want your friends to know about this newsletter? Share them!