Balena CLI not working on Apple Mac with M1 ARM Chipset

Hi everyone,

I recently switched from Intel Mac to ARM-based (Apple Silicon) Mac with Apple M1 Chipset and my balenaCLI fails pushing my project.

The error message points at a wrong architecture being used. It says:

[Warning] The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

The device-type I have set on my project on Balena Cloud is an RPi4 64-Bit.

Here’s the full dump:

[Info]     Starting build for balena-node-red, user g_simon_kemper
[Info]     Dashboard link: https://dashboard.balena-cloud.com/apps/1972788/devices
[Info]     Building on arm02
[Info]     Pulling previous images for caching purposes...
[Success]  Successfully pulled cache images
[main]     Step 1/7 : FROM balenalib/raspberrypi4-64-python:3-stretch-run
[main]      ---> 5f41c7def93e
[main]     Step 2/7 : WORKDIR /usr/src/app
[main]      ---> [Warning] The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
[main]      ---> Running in cb72b3554c2b
[main]     Removing intermediate container cb72b3554c2b
[main]      ---> 0d5cc714c948
[main]     Step 3/7 : COPY requirements.txt requirements.txt
[main]     failed to get destination image "sha256:0d5cc714c948e51d8dd40505446bc8b833199afa005a1e09ec5e357a155f80cb": image with reference sha256:0d5cc714c948e51d8dd40505446bc8b833199afa005a1e09ec5e357a155f80cb was found but does not match the specified platform: wanted linux/arm64/v8, actual: linux/amd64
[Info]     Uploading images
[Success]  Successfully uploaded images
[Error]    Some services failed to build:
[Error]      Service: main
[Error]        Error: failed to get destination image "sha256:0d5cc714c948e51d8dd40505446bc8b833199afa005a1e09ec5e357a155f80cb": image with reference sha256:0d5cc714c948e51d8dd40505446bc8b833199afa005a1e09ec5e357a155f80cb was found but does not match the specified platform: wanted linux/arm64/v8, actual: linux/amd64
[Info]     Built on arm02
[Error]    Not deploying release.
Remote build failed

The CLI is on latest version. The project I try to push can be found here.

Thanks,

Simon

Hello, since you were able to get the CLI running on your M1 Mac, I don’t think the switch to Apple silicon is the issue here. You may be running up against the issue mentioned here
Since you are only defining your base image as balenalib/%%BALENA_MACHINE_NAME%%-python:latest you are actually getting balenalib/raspberrypi4-64-python:3-stretch-run and this appears to indeed have an arch listed as linux/amd64 as seen here So my suggestion if possible is to use a newer base image by being more specific in your Dockerfile as outlined here. For instance, balenalib/%%BALENA_MACHINE_NAME%%-python:3.6-buster-run or similar which has the correct arch.

Hey, Balena Team! The Balena CLI is not yet officially supported on Apple Macs with M1 ARM chipsets. However, there is a workaround that you can use to run the Balena CLI on an Apple Mac with an M1 ARM chipset.

The workaround involves installing and running the Balena CLI inside a Docker container that runs on an x86_64 emulator. Here are the steps you can follow:

  1. Install Docker Desktop for Mac on your Apple Mac with M1 ARM chipset. You can download it from the Docker website.
  2. Once Docker is installed, open it and make sure it is running.
  3. Open Terminal on your Mac and run the following command to download the Balena CLI Docker image:

docker pull balenalib/raspberrypi3-node:12-build

  1. Once the image is downloaded, run the following command to start a new Docker container that runs the Balena CLI inside the x86_64 emulator:

docker run -it --rm --privileged --name balena-cli -v /var/run/docker.so

Moreover, If you still have any query regarding balena not working except Apple/Mac then you can further ask me for more information.