# How to do Wine and Homebrew on an M1 Mac

# The Goal

My goal was to be able to run Mikrotik's WinBox utility on a Mac M1 (ARM) laptop. WinBox is distributed as a single file, Windows executable, 32 and 64 bit versions, no installer needed.

# Options

Option 1: Download CodeWeaver's Crossover from the Apple Store. It just works. Also costs money.

Option 2: Regular Wine. But how?

# Homebrew

Everybody on a Mac loves Homebrew. Or at least they should. When M1 first came out, there was a x86_64 version installed to /usr/local and there was an arm64 version installed to /opt/homebrew.

I dutifully installed them both, because we need both, right? Well, I don't think we do. Check it out.

# To arm or to x86_64?

Initially, the word was to duplicate your terminal app (iTerm2 or Terminal), rename the second one to indicate that it would be executing through Rosetta, right-click Get Info, and check the "Open Using Rosetta" box. That works. But who wants to run extra terminal apps if you don't have to?

The key is this: arch -x86_64 ...COMMAND...

You can run the command arch -x86_64 zsh and have your command-prompt switch to using Rosetta. To be specific, the terminal will still run native arm, but the zsh process will run under Rosetta/Intel. Would this work for wine?

# iTerm2 -> Rosetta 2 -> wine64 -> winebox.exe

First, make sure you have brew installed under a normal, regular arm installation. Check out https://brew.sh for details.

Second, install wine. It can be in your normal arm installation area (/opt/homebrew) even though it requires the x86_64 environment to execute.

So, run brew install wine-stable or whatever flavor of wine you'd like.

Since I downloaded the 64-bit version of WinBox, we need the 64-bit version of wine:

arch -x86_64 wine64 ${HOME}/Downloads/winbox64.exe

Boom. Success.

Last Updated: 11/14/2021, 9:57:39 PM