LLVM Profile Error: Failed to write file "default.profraw": Permission denied

XcodeLlvm

Xcode Problem Overview


I'm getting the error LLVM Profile Error: Failed to write file "default.profraw": Permission denied after running unit tests in Xcode. I don't know where Xcode is trying to write this file to.

What folder should I grant permissions for?

Xcode Solutions


Solution 1 - Xcode

Had this warning when I forgot to enable code coverage:

enter image description here

Solution 2 - Xcode

Xcode 10+

Enable Code Coverage for Test scheme.

enter image description here

Solution 3 - Xcode

Cleaning my build folder eliminated the error for me. (Option-Shift-Command K.) I'm using Xcode Version 9.2 (9C40b). The error started when I added a set of images to my Assets.xcassets. After a full clean the error is gone.

Solution 4 - Xcode

Try setting CLANG_ENABLE_CODE_COVERAGE = NO in your build settings for the target being tested and the tests themselves.

Edit: Please see the answer by @kasyanov-ms.

Solution 5 - Xcode

This may not be helpful to anyone else, but I was hitting this when I had placed a exit(EXIT_FAILURE) in my code while refactoring a piece of code. I had assumed putting it in would crash the app right there and show me that it crashed there, but instead it was giving me this error and not showing where it had crashed.

Solution 6 - Xcode

Xcode 11 beta 1:

This is a known issue when attempting to use code coverage against simulator targets. You must either use a later beta or run coverage against a physical device.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCloud9999StrifeView Question on Stackoverflow
Solution 1 - Xcodekasyanov-msView Answer on Stackoverflow
Solution 2 - XcodemuhasturkView Answer on Stackoverflow
Solution 3 - XcodeJohn PavleyView Answer on Stackoverflow
Solution 4 - XcodeCoder-256View Answer on Stackoverflow
Solution 5 - XcodeEndersJeeshView Answer on Stackoverflow
Solution 6 - XcodeAllisonView Answer on Stackoverflow