Confusing about the analysis on Objective C


I am referring to the document , part of Analysis Steps Using Build Wrapper. I follow the steps to download the build wrapper for macos, unzip the downloaded build wrapper and configure it in my PATH. But it fails when I try to run the command

build-wrapper-macosx-x86 --out-dir build_wrapper_output_directory xcodebuild clean build

Can provide more information on what is the proper steps to install the build-wrapper instead of the high end solution in the documentation?

Hi @chuenwailiew,
Can you, please, be more precise on how it fails when you run your build under Build Wrapper?
Additionally, some details about your system might help: your SonarQube version, your macOS version, and the CPU architecture (x86_64, x86_32, M1, …)

Sonarqube version: 9.4
MacOS: 11.6.1

Screenshot 2022-05-05 at 4.01.28 PM

According to the document C/C++/Objective-C | SonarQube Docs I assumed this mean add to my PATH

I have configure the build wrapper in my .bash_profile (my machine is using this).

But when I tried to run the build-wrapper-macosx-x86 command it return command not found error (refer image below). Is it I configure wrongly?

It looks like build-wrapper-macosx-x86 is still not visible from your PATH.
Did you put build-wrapper-macosx-x86 into the root (/) directory? In order to make an executable available you should put the directory containing this executable into your PATH variable, so in this case it would be the root “/” directory:

export PATH=$PATH:/

However, I do not recommend that. instead, you can save the Bulid Wrapper executable into a dedicated directory and add that directory to the PATH variable:

mkdir /build-wrapper-dir
mv /build-wrapper-macos-x86 /build-wrapper-dir/build-wrapper-macos-x86
export PATH=$PATH:/build-wrapper-dir

I am pretty sure I put the directory in the root directory. (refer to image below)

I also tried the solutions provided by you. Unfortunately it is not applicable as root directory is not writable for MacOS Catalina and above (mongodb - Read-only file system when attempting mkdir /data/db on Mac - Stack Overflow)

Did you source your .bash_profile after the modification? Can you verify that echo $PATH prints the new directories?

You can check out this manual about adding an executable into your PATH.
Another point is to make sure build-wrapper-macosx-x86 has the executable permission.

Yes, I had source my .bash_profile, and the PATH is added

On your Finder screenshot you are showing your home directory (/Users/000751/). As you say yourself, on your OS the root directory (/) is not writeable, so I imagine it is rather difficult to add a build-wrapper-macos-x86 directory there. To verify that you indeed have extracted Build Wrapper into the root “/” and not your home directory “~”, you can execute ls / to display the contents of the root directory and ls /build-wrapper-macos-x86 to show the contents of the Build Wrapper directory in the root directory.

Do you confirm that you’ve indeed extracted Build Wrapper into the root “/” and not the home “/Users/000751” directory?

Alright, I got what you mean. I will try it out!


Hi Arseniy,

I don’t think I can access to root directory because of the company security’s issue. However when I try to study on the other option Analysis using compilation database , I don’t really understand how this should be done. Is there any more details and clearer example on this?

Instead of extracting Sonar Scanner and Build Wrapper into your root directory, you can extract them to your home directory as you did, and add the corresponding paths to your PATH:

Here is an example that does this: macos-xcode-otherci-sc/ at main · sonarsource-cfamily-examples/macos-xcode-otherci-sc · GitHub

If you want to use a compilation database, you will need to find out how to generate it with your build system. Unfortunately, I help you unless you know how to generate a compilation database. Here is an example of using a compilation database with CMake.

Let me know if this helps.

Hi, I am facing new problem here.

Any help is much appreciated!

Hi @chuenwailiew,
Please provide some context: how are you running the Sonar Scanner and the Build Wrapper? Do you execute any command (e.g. cleaning the intermediate build files) or perform any action in your IDE between the runs of Build Wrapper and Sonar Scanner?
Additionally, these logs might be helpful: full execution log produced once you add the -X option, the “build-wrapper.log” and the “build-wrapper-dump.json”.

Hi @necto,
So this is the steps I did:

  1. Clean build folder.
  2. Clear Derived Data.
  3. Execute pod install command.
  4. Execute the build-wrapper command.
  5. Run the sonar scanner.

I can’t provide you the “build-wrapper.log” and “build-wrapper-dump.json” as the file is exceed 8MB limit.

Can you tell me more about the “pod install command”?
Do you run your build in some kind of a container, on a virtual machine, or on a remote host?

So Pod basically is a platform for iOS as some kind of container to use third-party library. “pod install command” does help us to download the library we need to use in our project, if it is not execute, it will cause build fail. That’s all what it does.

The issue is that analysis has to be done in the same exact environment where the build was done, with all the intermediate build files still being present in the same places. If you run build in one container/VM and analysis in another container/VM or on the host, analysis will fail. Do you run build and analysis in the same container/VM/host?

Yes, it is in the same container/VM/host.

Yes, it is in the same container/VM/host.

Alright, that’s good.

Can you copy here the

full execution log produced once you add the -X option


And for build-wrapper.log and build-wrapper-dump.json, I’ll let you use a cloud file-sharing service (think Dropbox, Googld Drive, SENDfiles, or others).