initWithURL vs initWithBundleIdentifier giving different permissions

I am directed from https://discuss.appium.io/t/create-multiple-instances-of-the-same-app/41266/14?u=lxnm, the context is that Appium max2 driver is implementing the activating of MacOS app using XCTest API methods. There are 2 ways to implement the activating of the app, using app path (calling initWithURL) and bundle id (calling initWithBundleIdentifier). This pull request shows how the XCTest methods are called when using the Mac2 driver, specifically in the file WebDriverAgentMac/WebDriverAgentLib/Routing/FBSession.m.

The problem is that I am able to launch my MacOS app(it is a company app) using bundle id, but when I launch the app with app path, I receive XcodeBuild errors: [WebDriverAgentMac] [xcodebuild] XCTExpectFailure: matcher accepted Assertion Failure: Failed to launch com.company.companyApp: You do not have permission to run the application “companyApp”. You don’t have permission. To view or change permissions, select the item in the Finder and choose File > Get Info. (Underlying Error: The operation couldn’t be completed. Operation not permitted)

I followed this to enable R+W permissions to all users, but the same error is displayed.

I am facing this alert alongside the error: https://www.google.com/search?sca_esv=599381486&rlz=1C5GCEM_enSG1085SG1085&sxsrf=ACQVn08p2zruWHRlr1ZuEFBqGC3ulbSYyw:1705561703858&q=The+application+%E2%80%9C(null)%E2%80%9D+does+not+have+permission+to+open+%E2%80%9C(null)%E2%80%9D.&tbm=isch&source=lnms&prmd=vinsbmtz&sa=X&ved=2ahUKEwi2z4C8sOaDAxWp8DgGHd2yAdAQ0pQJegQIFBAB&biw=1484&bih=1164&dpr=1#imgrc=3C8WjqxL6N2PNM

Correction: it is Appium Mac2 driver

It seems likely that this has to do with Appium's method of running xcodebuild and using XCTest functionality. We would be happy to investigate this issue if this is reproducible from Xcode running the initWithURL method on XCUIApplication in a UI testing bundle

initWithURL vs initWithBundleIdentifier giving different permissions
 
 
Q