DEV Community

Yufan Lou
Yufan Lou

Posted on

Adventure Migrating to Apple Silicon

Setting up my Apple Silicon Macbook Pro. It is really snappy! and quiet!

I chose to jump on the new ship because I am very anxious about battery life and could barely disconnect the charger from my old Macbook Pro. With the new Macbook Pro I was compiling stuff and watching video and after three hours the battery shows 82%. That feels so reassuring.

Other than that, the biggest reason I am migrating away from my old Macbook Pro is its keyboard problems. I actually prefer the clicky feel and light actuation force I get on the Butterfly keyboard, but I have got several keys shadowing (type twice when pressed once) and my tab key is stuck. The Magic keyboard is heavier, very similar to my old Macbook Air.

I chose not to migrate my application folder, and decided to reconfigure my zsh environment so I moved my zshrc to a backup file.

I reinstalled IntelliJ IDEA and it runs nicely enough after translation by Rosetta 2. It feels on par with my Intel Macbook for what small projects I have. The menu highlight lags behind the cursor a bit. I will test it further in the coming days.

My homebrew installation is migrated and the Intel git from it worked. That confused me a bit at first. How seamless it feels. I still chooses to unlink it.

On the other hand, my Intel brew is prohibited by the devs from installing new programs while they figure out Apple Silicon support. So I set out to follow the community guide and installing a new homebrew at /opt/homebrew for Apple Silicon.

Parallel to that, to recover my Starship command line prompt I set out to install Rust. My Intel Rust toolchain is also migrated so when I ran the installation script from rustup it updated my Intel toolchain instead. I set up the PATH according to its instruction, and installed the Apple Silicon toolchain with rustup toolchain install beta-aarch64. I set it as default with rustup default beta-aarch64.

Trivia: the architecture of Apple Silicon is called ARM64, but the architecture in the Rust triplet is called AArch64. This difference is a historical artifact from Apple and ARM developing their 64-bit ARM architecture in parallel. Linux initially called this backend ARM64, and Apple did so in-house too, but ARM chose to call it AArch64 (and the 32-bit mode AArch32) when ARM released ARMv8-A. In LLVM, the two backends merged on 24 May 2014 into a new ARM64 backend.

cargo install starship gave me an error about wrong architecture regarding libgit2. I realized it was linking with the Intel libgit2 migrated over, originally installed by my Intel homebrew. I unlinked it and tried again. This time the error is about sysinfo. A pull request has fixed this issue but it is not released yet, so I use cargo install --git https://github.com/starship/starship.git instead, and it built successfully.

Now that starship is in command, I go back to the homebrew installation. I now have Intel brew at /usr/local/bin/brew and ARM brew at /opt/homebrew/bin/brew. I don't want to mess with my executables but I want to install ARM libraries so I can build against them. So I add /opt/homebrew/bin to PATH before /usr/local/bin. I use /usr/local/bin/brew bundle dump to dump the list of all installed packages to a Brewfile. I went into it and added # to every line to comment them out, and only removed it for lines with lib in it. Then I /opt/homebrew/bin/brew bundle to install from the file, and plugged the Macbook in and went to sleep.

With the relatively small number of libraries I have, I met three libraries failing to install: libbluray, libsoxr, and libgcrypt. libbluray is blocked on openjdk failing. libsoxr and libgcrypt are listed as working on the community guide, but I see the following error for libsoxr:

Undefined symbols for architecture arm64:
  "_av_get_cpu_flags", referenced from:
      _soxr_create in soxr.c.o
ld: symbol(s) not found for architecture arm64
Enter fullscreen mode Exit fullscreen mode

and the following error for libgcrypt:

PASS: bench-slope
SKIP: hashtest-256g
======================================
1 of 27 tests failed
(1 test was not run)
Please report to http://bugs.gnupg.org
======================================
Enter fullscreen mode Exit fullscreen mode

I later found Sam's great post to realized that I need arch -x86_64 prefix to install things with Intel homebrew. I will try this when chance presents.

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay