Instruments wants permission to analyze other processes Jenkins - xcode

So my problem is that on pure swift project (almost :-) ) with test written also in Swift I got this every build. Build is started via Fastlane 1.63. :
▸ DTServiceHub: Instruments wants permission to analyze other processes. Please enter an administrator username and password to allow this.
▸ Username (jenkins): Password:
▸ Failed to authorize rights (0x1) with status: -60007.
Problem occurs when new command-line-tools and Xcode 7.3 was installed on MacPro with OSX Server. Objective-C project works every time. I've done what was suggested in those threads, didn't work:
Remove the authorization prompt from command line instruments (Under mavericks)
Is there a way to remove the authorization prompt from command-line instances of Instruments (XCode)? and in all other places that I could find. I have no idea how to fix it.

I just experienced a similar problem, triggered by Fastlane scan command to execute tests.
Following the discussion on this issue and this Apple Support discussion I managed to solve it by enabling "Developer Mode" on my CI machine.
$ DevToolsSecurity -status
Developer mode is currently disabled.
$ DevToolsSecurity -enable
Developer mode is now enabled.

I've got the same problem with Xcode 7.3. I wasn't admin on my Mac (I work on a company network) so the network manager gave me the admin rights and it works... I don't know why :)

Related

“qmake” cannot be opened because the developer cannot be verified

I'm trying to install the omnetpp simulator abut I was not able to use its graphic interface. To run it properly I have to install Qt5 which I did through homebrew. My Qt version is 5.15.0 and my MacOS is Catalina (10.15.5 (19F101)).
When running the ./configure command to install omnetpp, I got the following error:
“qmake” cannot be opened because the developer cannot be verified.
In summary I had problems with the omnetpp when trying to run the graphic interface Qt, then I've installed Qt5 and now I get an error telling me that qmake cannot be verified.
Thanks,
The problem is that this will come many times... It has something to do with the new security settings for MacOS Catalina.
I found another work-around, which worked very well for me. Go to Systems Preferences -> Security and Privacy -> Privacy. Scroll down the left menu to Developer Tools and allow Terminal to run software locally (tick the box).
I was able to circumvent this problem by opening System Preferences, Security & Privacy, General, and then allowing the file to be executed. When I ran make again the Qmake command ran without any warnings or windows popping up.
According to Apple's website, you need to find qmake in the Finder, CTRL+click on it and press "Open". After that, qmake will be marked as an authorized app and you can run ./configure again.
I am a Windows user and could find the official Apple support page (https://support.apple.com/de-de/guide/mac-help/mh40616/mac) within a minute of googling, by the way.
You can run the following command to "un-quarantine" your binary (assuming its path is /usr/bin/qmake):
xattr -w com.apple.quarantine "00c1;$(xattr -p com.apple.quarantine /usr/bin/qmake | cut -d";" -f2-4)" /usr/bin/qmake

Failed to launch macOS app built in Xcode

I've built an App in Xcode in release mode. Is signed with valid Developer ID certificate. And the app launches fine on some MacBooks.
But on another launch fails with error
The application %name% can't be opened.
Then I try to launch it from terminal with open command it says
LSOpenURLsWithRole() failed with error -54 for the file /Applications/Gaetano Lunches.app.
And then I try to launch directly the binary file from package contents
it says
-bash: /Applications/Gaetano Lunches.app/Contents/MacOS/Gaetano Lunches: Operation not permitted
On all MacBooks app installation from Anywhere is allowed. spctl-master is disabled. Permissions for files are correct. But the app cannot be launched.
I don't know how you are building your app, but if LSOpenURLsWithRole is returning permError = -54, this means you have a permission error on opening a file. This can mean a lot of things, but building an app in release mode is no longer what Apple recommends for you to do. Apple prefers that you use Archive and then you export the app in Organizer to be used by your users. By using this work flow, normally you can do everything using the Xcode defaults for building an app. If you don't, then you need to be more careful with the settings you choose for building in release mode.
For a quick and dirty approach, I would try the following:
1) Open the terminal
2) Type: chmod +x "/Applications/Gaetano Lunches.app/Contents/MacOS/Gaetano Lunches"
3) Try to launch your app and see if it helps. If it helps, there is something messed up with your build settings, which is failing to change the file permissions somewhere for your executable to have the right permissions to be launched.
Another thing you could try is see whether your app was blacklisted by Gatekeeper, because somehow it determined your app is doing suspicious things on your own system. If that is the case, then you can try this to see what gatekeeper is assessing:
spctl -a "/Applications/Gaetano Lunches.app"
If for some weird reason you app is being blacklisted by Gatekeeper, you can always add your app manually and whitelist it for Gatekeeper:
spctl --add "/Applications/Gaetano Lunches.app"
If all fails, you can try to reset the whole database, but you will need super user access:
sudo spctl --reset-default
However, I think these are just quick fixes, and if you keep needing this is because your build settings in Xcode must be adjusted. More on that, if any of these solutions work. Let me know about that.

Cannot install Xcode Command Line tools over a corporate proxy

I'm having trouble running the following command in the Terminal:
xcode-select --install
After agreeing to the T&Cs, I get the following error pop up:
Can't download the software because of a network problem.
As I am behind a corporate proxy for the company I work for, I've correctly set this up on my Mac in System Preferences and I can browse the web normally. I also added the proxy settings via these commands that I was given (real URL removed):
export http_proxy="http://example.net:80"
export https_proxy="$http_proxy"
I tried following this thread on Reddit, which suggested deleting App Store preference files, but that didn't work.
I'm a bit lost now because I don't know how else to approach the issue. Perhaps there is something around installing things via the Terminal that I don't know of, in relation to proxy settings?
Xcode's Command Line Tools can be downloaded directly from https://developer.apple.com/download/more/

Teamcity Max OS X Agent - Incompatible runner: Command Line

I am running TeamCity 7.1.3 (yeah, I know it's an oldie). I have a Mac OS X Yosemite build agent.
I started the agent in the recommended way, sh bin/agent.sh start.
My build configuration contains one command line build step, but it can't run, because I get the following message on my agent:
Incompatible runner: Command line
I think it is a permission issue, because if I start the agent with sudo sh bin/agent.sh start it works. I don't want to run it with sudo though. Is there a permission I can give my agent account to make this work?
Update: it seems "chmod 777" on the buildAgent folder solved the problem. Of course, it is not the most secure idea. Would be happy to know the lowest permissions I need to apply.
When you installed the agent, did you use the Mac setup script in the agent's bin directory? I believe it's called mac.launchd.sh. You can't run it via remote terminal or Apple's Remote Desktop or you'll have issues. From the machine (or via VNC) login as the user you want to run TeamCity and run that script from Terminal. Then the agent will start on user login, and will properly upgrade itself when you finally get to upgrading to the latest TeamCity.
My experience with Mac OS X TeamCity agents improved greatly when I stopped trying to run it in the background as a 'daemon' (launchd's term for a boot service) similar to Linux, and instead ran it as an 'agent' (on login service). Typically on a Mac OS build agent you'll want auto login enabled for bits of Xcode to work correctly. Then you just lock it with a screen saver.

Why do I need root privileges to run GDB?

When I start GDB from the command line I have no problems. But when I start debugging a programs from NetBeans (C++), I get this message:
"Type the name and password of a user in the "Developer Tools" group to allow Developer Tools Access to make changes."
My user is already in the "Developer Tools" group, but this fact seems to be ignored.
With the root password it lets me debug, but I would not debug with the root account!
I checked the GDB executable and path, and they all grant executable permissions to everyone.
Any idea?
Thank you!
Platform:
MacOS X 10.6.6
NetBeans 6.9.1
GCC 4.2
GDB 6.3.50-20050815
I believe you will find the answer over here: Stop "developer tools access needs to take control of another process for debugging to continue" alert
Basically, you can reinstall Xcode or fix the authorization database.
No, you shouldn't need root privileges to run GDB. Does your software need to run as root? If your software runs as root GDB will also need to be run as root.
What happens if you run GDB on the command line?

Resources