Tuesday 23 February 2021

Running Windows Apps on Apple Mac M1 with Crossover

Another approach to running Windows apps on Mac M1 with ARM architecture is to use Crossover, which is based on the venerable WINE (Windows Emulator) application. This emulates the Windows system call interface and so runs applications directly on the Mac rather than through a VM like Parallels.

To try it out I did

1. Download Crossover for Mac ARM and install it
https://www.codeweavers.com/crossover/download

2. Run Crossover. You can use it free for 14 days as a trial version. It's inexpensive compared to Windows and Parallels licences.

3. Click Install a Windows Application.
In the search box type "Steam".
Click it from the list. 
Click Continue.
On the Select Bottle tab choose Windows 10  64-bit Bottle. Click Continue.
Go through various Windows software installation screens clicking continue.
You now have a Windows 10 Bottle called "Steam" containing Steam app.

4. Click Install a Windows Application.
Type "DXVK". Select it from the list and install to the "Steam" bottle.

5. Click Install a Windows Application.
Select application DirectX for Modern Game and install to the "Steam" bottle.

6. In Crossover, right Click Steam App / Settings  DXVK Backend for D3D11 and save it.


7. Click the Steam icon to run it. Login and try out a Windows Steam game.  That worked for me.

Here is a YouTube video I followed to get started https://www.youtube.com/watch?v=3TdCV7fn2CA


Run Windows 10 ARM preview on Mac M1

1. Download and install the Parallels desktop beta for Mac M1 ARM architecture 
https://www.parallels.com/directdownload/pdbeta

2. Sign up for Microsoft Insider Program https://insider.windows.com/en-us/en-gb 
to get access to download their Windows 10 on ARM preview release
https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewARM64

3. Run Parallels and create a new VM from the ISO.

There's a video on YouTube I followed https://www.youtube.com/watch?v=A0qNgThYLkw

I've tried it out and it seems to work well. Steam glitched a bit on the main window (the small view worked fine) and I was able to play a couple of games from my library.




Run a vagrant virtual machine Fedora 33 for ARM on Mac M1 under Parallels virtualisation beta

I managed to build and run a vagrant Fedora VM box on Mac M1 ARM architecture using the Parallels virtualisation beta and packer to build the vagrant box.

Full details and packer source code at https://github.com/peterdragon/packer-M1-parallels-fedora33






Setting up homebrew on Apple Mac M1 with ARM architecture

Homebrew https://brew.sh/ lets you install and manage packages and applications from the command line on MacOS.

The new Apple Mac M1 is running Apple Silicon technology which is based on ARM processor (aarch64 architecture) rather than Intel processor (x86_64 architecture). This can cause some issues when wanting to run software compiled for x86_64 when a version is not available yet on aarch64.

To work around this, Apple provide Rosetta which provides an emulation layer to execute x86 opcodes under ARM. You can install Rosetta from terminal with

$ /usr/sbin/softwareupdate --install-rosetta --agree-to-license

To make it simpler to switch between ARM and x86 mode copy set up a new terminal profile which will run under Rosetta emulation.

Run terminal, press Apple + , to open Preferences. Click on your favourite profile, e.g. mine is called "a Homebrew".


Click the three dot icon at the bottom and on the popup menu click Duplicate Profile. 


Enter a name like "Rosetta Shell" and click on the tab Shell then tick Run command and enter 

env /usr/bin/arch -x86_64 /bin/bash --login


Now if you run terminal using your usual profile it will give you a terminal session running in ARM mode.
If you click menu Shell / New Tab then you should see a list of profiles. Click on the Rosetta Shell one you created.


You should have two tabs open. The first is your ARM mode shell. The second is your Rosetta x86 mode shell.

You can click between them to run commands now for either mode.

We'll install Home brew for both ARM and x86.
For ARM mode it will go in the default location /opt/homebrew.
For x86 mode it will go in /usr/local.

In the first tab, type 

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

It will install ARM brew to /opt/homebrew/bin/brew.

In the second tab, type the same command.
It will install x86 brew to /usr/local/bin/brew.

Finally I add some lines to my shell startup profile ~/.bash_profile to detect which mode I am running in and to set the correct path to brew. I also change the prompt so that I get an i when in Intel x86 mode.
Edit ~/.bash_profile and add

if [ "$(sysctl -n sysctl.proc_translated)" = "1" ]; then
    # run under rosetta 2 with
    #   env /usr/bin/arch -x86_64 /bin/bash --login
    #local brew_path="/usr/local/homebrew/bin"
    eval $(/usr/local/bin/brew shellenv)
    export PS1="i \D{%I:%M %p}:\w $ "
else
    #local brew_path="/opt/homebrew/bin"
    eval $(/opt/homebrew/bin/brew shellenv)
    export PS1=" \D{%I:%M %p}:\w $ "
fi

Now when I logout of terminal and back in I see either the ARM prompt

or the x86 prompt with an i to remind me of the mode

Note that I am using bash for my Apple shell. The system default is now zsh so you will need to adapt this if you use that.


Not all packages are available yet under ARM brew.
However, the full range is available under x86 brew running under the Rosetta x86 emulation.

E.g. $ brew install ruby