SonarScanner on MacOS using Jenkins job

Hi there,

I am new to SonarQube and would appreciate your help.

I am using sonarqube- on my local Mac computer. I plan to run sonar scan using jenkins for my code. I have setup the tooling in my Jenkins and have set the path for MSBUILD_SQ_SCANNER_HOME as /Users/macintosh12/.jenkins/tools/hudson.plugins.sonar.MsBuildSQRunnerInstallation/SonarMSBuild

However when I try to run the scan, I receive this message: /Users/macintosh12/.jenkins/tools/hudson.plugins.sonar.MsBuildSQRunnerInstallation/SonarMSBuild/SonarScanner.MSBuild.exe: cannot execute binary file

This snippet is from one of the stages in my Jenkinsfile:

stage('Begin SonarQube Analysis') 
							sqScannerMsBuildHome = tool 'SonarMSBuild'
							sh "${sqScannerMsBuildHome}/SonarScanner.MSBuild.exe begin /k:Persona / /d:sonar.login=****** /d:sonar.password=******"

I am not sure if .exe would work on mac, How do I fix this?


Hey there.

You aren’t going to be able to run a .exe on a Mac.

What language(s) are you trying to analyze?

:warning: Make sure you upgrade to SonarQube v9.9 LTS soon, not only to benefit from our Best LTS Ever™, but because soon we will systematically ask users to upgrade when they ask questions about earlier versions of SonarQube, which are now considered unsupported. :smiley:


Welcome to the community!

Are you able to build the project on your Mac?


Apologies for the delay, I was able to solve the issue by adding mono at the beginning of my script, this was able to successfully scan my project. I am using MSBuild for a c# project.

In case someone is facing the same issue, here is my fix:

sh "mono ${sqScannerMsBuildHome}/SonarScanner.MSBuild.exe begin /k:project-Key / /d:sonar.login=****** /d:sonar.password=******"

Thank you.


1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.