Running sonar-scanner on Apple M1 (arm64)

I am curious on the status of when sonar-scanner will be supported on Apple’s M1/M2 arm64 architecture. We’re using Apple’s silicon in CI to build and scan swift and we’re currently using Rosetta to get around the lack of support.

I also have a follow up question. The scanner is essentially a shell wrapper that uses provided x86_64 JRE to run. Looking at the script, here’s an interesting set of lines from the script:

if [ "$use_embedded_jre" = true ]; then
  export JAVA_HOME="$sonar_scanner_home/jre"

This is forcing the use of the provided x86_64 JRE. I am curious what the implications would be if I were to disable this and force the use of already installed arm64 JRE? I did try it and the scanner works in our environment but since I didn’t test it across various languages and with different profiles, I suspect the situation is a bit more nuanced.

If this setting were exposed as an option to the user, could this be an option for Apple silicon users for now until the full support is provided? Feature request for the scanner? :grinning:


Hey there.

If you download the “any” flavor of the scanner, you can provide your own JVM.

And, we know that currently C/C++ analysis (using the build wrapper) and Go analysis does not work on Apple Silicon.

More complete support (across languages, Docker images) is on our roadmap!

Oh, didn’t realize there is an any flavor, that’s perfect, thanks!

1 Like

Sure thing! It’s visible on the SonarScanner CLI docs but easy to overlook. Just wanted to point you there in case you need to find it (or a new version) again.

If you run into any limitations I didn’t list before, please let us know. Almost all SonarSourcers using a Mac are using an M1 Mac, and we naturally we run scans every day!

Hi Colin,

I have an Objective C / Xcode project that I’m trying to run sonar-scanner with Apple Silicon. I was wondering if this yet supported either using build wrapper or with compilation database.



Hey there.

It is supported using the compilation database.