Gitlab CI: Unable to find a device matching the provided destination specifier

Gitlab runner on M4 Mac Mini 2024, XCode 26.2, supported platforms: iOS, native UIKit swift project. Cocoapods.

Trying to run tests via fastlane:

run_tests(workspace: 'Project.xcworkspace',
            destination: "platform=macOS,id=#{deviceId}",
            scheme: "Release",
            clean: true)

And having an error:

$ xcodebuild -showBuildSettings -workspace Project.xcworkspace -scheme Release -destination platform\=macOS,id\=01234567-0123456789B9001C 2>&1

[12:23:53]: Could not read the "SUPPORTED_PLATFORMS" build setting, assuming that the project supports iOS only.

[12:23:54]: Found simulator "iPhone 16 Pro (18.5)"

The tests runs just fine in xcode on "My Mac (Designed for iPad)" device on the very same machine. Compared the output of xcodebuild -showdestinations in terminal:

$ xcodebuild -showdestinations -workspace Project.xcworkspace -scheme Release

Available destinations for the "Release" scheme:

{ platform:macOS, arch:arm64, variant:Designed for [iPad,iPhone], id:01234567-0123456789B9001C, name:My Mac }
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
{ platform:iOS Simulator, arch:arm64, id:A7E98A79-B29B-4E9A-8103-ECBA55ABC0C6, OS:26.2, name:iPhone 17 Pro }

But when I launch this command in gitlab runner, I get this:


Available destinations for the "Release" scheme:
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
{ platform:iOS Simulator, arch:arm64, id:A7E98A79-B29B-4E9A-8103-ECBA55ABC0C6, OS:26.2, name:iPhone 17 Pro }

I suspect gitlab runner to ruin some ENV variable, probably. So I googled the most common issues on the internet and tried everything I found:

LANG: "en_US.UTF-8"

LC_ALL: "en_US.UTF-8"

unset CFProcessPath

And none is worked.

I also compared the printenv output in terminal and gitlab runner, didn't found anything suspicious. Ran out of ideas. How can I troubleshoot this?

Gitlab CI: Unable to find a device matching the provided destination specifier
 
 
Q