Coffee, code, and GIFs. Not necessarily in that order.
© 2023. All rights reserved.
I recently bought an Apple Silicon based Mac Mini for my home office setup, and was excited to see if I could do development for with Forem on it. After a little bit of experimentation I haveForem running locally, and wanted to document the steps I took in case anybody else is curious or looking to make the switch.
The executive summary: it’s very possible to develop and run Forem on Apple Silicon without many changes, even at this early stage.
First a bit of background: my day to day development environment is a 2019 15” MacBook Pro with a 2.3GHz 8-core i9 processor and 16 GB of memory. I develop Forem locally using the installation instructions for MacOS at https://docs.forem.com/installation/mac/
While my MacBook Pro (and all modern Macs before it) have Intel processors, the new Apple Silicon based Macs run on an ARM based M1 processor. Intel processors run executables compiled for x86 architecture, and the M1 runs code compiled for ARM64 architectures. These two processors basically speak difference languages.
It would be an huge problem if the Apple Silicon Macs couldn’t run x86 code as that would mean the last 20 some years of Mac software would be incompatible with them. As a stopgap measure Apple has a software translation layer called Rosetta 2 which can “translate” x86 executables on the fly to ARM64 code (important note: I am not a low level software engineer and this is a huge over simplification of Rosetta 2. Apple’sdocumentation about Rosetta 2 leaves a lot unexplained).
As an absolute low bar we could just run all of Forem (and associated development tools) under Rosetta 2 and call it a day. There’s a performance penalty, but the M1 chip is so fast that even under Rosetta 2 I’m finding most processes run just as fast as they did on my Intel based MacBook Pro.
You can run any process in Terminal via Rosetta 2 by prepending the commandarch -x86_64
. So the easiest way to setup Forem on M1 is to just install the x86 version of everything.
Install Homebrew with Rosetta 2:
$ arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Then you can run Homebrew in in x86 mode by using:
$ arch -x86_64 brew
Typing that every times gets old really fast, so I created an alias in my~/.zshrc
file:
alias ibrew='arch -x86_64 /usr/local/bin/brew'
(the i is for Intel!)
Proceed with the rest of theinstallation instructions, and you’re done! Remember to use theibrew
alias so Homebrew installs the x86 version of packages.
Sure, you can just run everything in x86 mode, but where is that fun in that: I bought an Apple Silicon Mac for it’s incredible performance, so let’s try to install as much as possible in the Arm64 architecture!
There’searly initial support for Apple Silicon in Homebrew, but they recommend installing both the x86 and Arm versions side by side as many Homebrew recipes haven’t been updated for Apple Silicon yet. I used Sam Soffe’sexcellent write up to install both the x86 and Arm versions of Homebrew side by side.
After installing the x86 version of Homebrew, we’ll install Homebrewwithout the x86 prefix (which installs it as a native Arm64 executable), but we’ll do so in a different place than the default/usr/local/bin
so we don’t overwrite our x64 Homebrew:
$ sudo mkdir -p /opt/homebrew$ sudo chown -R $(whoami):staff /opt/homebrew$ cd /opt$ curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
Finally, we’ll put this Arm64 Homebrew on our path before the x86 version. Back in our~/.zshrc
file:
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
Now if we want to install an x86 version of a package we’ll useibrew
, and if we want the Arm64 version of a package we’ll usebrew
.
Working through the Forem development environment setup instructions, as of January 5, 2021 I was able to use native Arm64 versions of everythingexcept ElasticSearch and Ruby.
ElasticSearch is dependent on OpenJDK, which doesn’t have an Apple Silicon version ready yet.
Ruby works on Apple Silicon, as do most gems. The problem is any gem that has “native extensions” needs that extension to be built as an Arm64 version if you’re going to run it on Arm64 Ruby. Most do, but I ran into a few older gems that just wouldn’t build:
dyld: lazy symbol binding failed: Symbol not found
when trying to actually run Rails.Given these gem issues I’m using the x86 version of Ruby. While Ruby and friends do work just fine under Rosetta 2, there are a few idiosyncrasies because we have two versions of Homebrew install. First: I had both the Arm64 and x86 versions of thereadline
andopenssl
libraries installed. Since I’m building an x86 Ruby, I want it to use the x86 versions. To forceruby-build
to use the proper libraries, I added the following to my~/.zshrc
:
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(ibrew --prefix openssl@1.1) --with-readline-dir=$(ibrew --prefix readline)"export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
If you installed the Arm64 version PostgreSQL you’ll be missing the x86 version oflibpq
. I solved this by installing the x86 version oflibpq
, then adding it to the beginning of myPATH
:
brew install libpq
Then in~/.zshrc
:
export PATH="/usr/local/opt/libpq/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"
Hopefully in the next few weeks these gems will be updated, or the Forem community will work on replacing/forking them.
And Docker fans…no, it’s not ready yet, but it’s inpreview. Stay tuned.
Expect ** a lot** of changes in the coming weeks. I expect it won’t take too long for Arm versions of most Homebrew packages and native gems to be available. Two great sites for checking progress areIs Apple Silicon Ready? andDoes It Arm?.
If you run into any problems developing or running Forem on Apple Silicon, please open an issue on ourissue board.
An absolute deluge of iPad announcements were made today, including:
Not a ton seems to have changed on the iPad Pro: there are a bunch of new camera features (some to support enhanced augmented reality), but the processors only looks slightly improved. As someone who never uses his iPad for photography or AR, there’s not a lot here to tempt me to upgrade.
The bigger changes are around pointer support: iPadOS 13.4 will add native support for mice and trackpads as well as a lovely new Magic Keyboard cover with an integrated trackpad. It’s great to see iPadOS diverging in features from iOS as was promised back when it was split off last year. And yes: the Magic Keyboard will be backwards compatible with 3rd generation iPad Pro modelshttps://www.macrumors.com/2020/03/18/new-magic-keyboard-supports-2018-ipad-pro/.
It’s a solid round of updates, and a testament to the initial design of the 2018 iPad Pro that there aren’t a ton of hardware changes to by made outside of small upgrades. I’m curious to see if the RAM situation has changed at all, but I’m not planning on upgrading this time. I’m absolutely going to grab that new Magic Keyboard cover, and I’m still hopeful WWDC 2020 will bringsome way to develop apps on iPadOS.
This is my first week as a member of the team at DEV! I’m beyond excited to be joining this team of dedicated, passionate humans.
I’ve been a huge fan of the DEV community since way back when it started at @thepracticaldev on Twitter. As a longtime lurker (and very, very occasional contributor), I’ve learned so much from DEV community members sharing what they’ve learned. It’s time to give back, and I’m excited to get started!
Hi there! 👋 I’m 42 years old, and live with my husband and daughter in Sturgeon Bay, Wisconsin: a tiny town on the shores of Lake Michigan. Our part of the state is in Door County, which is a popular tourist area: it’s a peninsula full of beaches, state parks, and cherry orchards. My family has been vacationing here since I was a baby, and a few years ago we were lucky enough to finally make this place our home. Expect the #DoorCounty hastag on DEV to blow up now that I’m here 😂
I’ve been a software engineer for two decades, working mostly in small startups. Most of my development work over the past few years has been with Ruby: I started using Rails with version 0.9. For the past decade I’ve worked remotely: remote work has allowed me to remain in this industry despite living far from a metro area.
When I’m not writing software, I’m an avid chef, photographer, and gamer. I’m also one of those crazy CrossFit people 🏋️♂️
The vast majority of my career has been spent in private, closed source software. I’m excited to be more involved with the open source community, and help DEV accomplish their longer term goals that Ben outlined in hisrecent post. I’m also going to be focused on helping the DEV team to be an even better remote team by lending my experiences working across multiple time zones.
Want to get in touch? My DM’s are open here, and I’m also available on twitter (@joshpuetz) or via email (josh@dev.to).
To say I’m a fan of the iPad would be an understatement. I’ve owned almost every iPad since the original model came out all the way back in 2010. The introduction of the iPad Pro in 2015 (along with the introduction of the Apple Pencil and Keyboard Cover) cemented the iPad as my primary non-work computer. Increasingly it’s becoming my work computer as well, something I’ll write about more in the future.
It should come as no surprise then that I pre-ordered the recently introduced third generated iPad Pro. I’ve been using a 12.9 iPad Pro with LTE for the last few weeks in a variety of environments (at home, on vacation, on a plane, and at a technical conference): here are my rough impressions of the hardware and software so far: