Why do I need root privileges to run GDB? - macos

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?

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

Instruments wants permission to analyze other processes Jenkins

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 :)

Eclipse GDB MacOSX Mavericks [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have had terrible problems making an Application Debug using Eclipse C/C++ project with XCode 5.0 and I have finally made it. I have finally been able to successfully debug my application and that's why I decided to make this little tutorial hoping to save time to others.
When trying to debug and application written in C/C++ on Eclipse on Mavericks OS it comes up with "Error gdb -- version".
This is because Eclipse cannot find GDB debug on new Mac OSX because Apple discontinues GDB support in place of LLDB. To check if this is your case simply try to run from Terminal gdb and it will show up as file not found.
The problem is that LLDB is not configured for Eclipse yet (or the other way around). So how to make your Eclipse debug the application again as in previous 10.8 OS?
First get and compile the GDB. You have two possible options:
Macports (Unfortunately, the Mavericks release got stuck in Building getext library)
Homebrew
My suggestion is to get it from Homebrew. Check on their web site the download link and install using
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/hebrew/go)"
Let it install. After it successfully installed GDB you need to sign a certificate to make Eclipse able to use GDB otherwise it will show up the error:
Unable to find Mach task port for process-id 28885: (os/kern) failure
(0x5). (please check gdb is codesigned - see taskgated(8))
This means Eclipse can find the GDB now but cannot run it because of the Apple certificates issue.
To sign the GDB application and make it possible that Eclipse runs it follow the guide here:
https://sourceware.org/gdb/wiki/BuildingOnDarwin
which can be summarized in:
Start Keychain Access application (/Applications/Utilities/Keychain Access.app)
Open menu /Keychain Access/Certificate Assistant/Create a Certificate (TOP MENU BAR)
Choose a name (gdb-cert in the example)
3.1 Set "Identity Type" to "Self Signed Root"
3.2 Set "Certificate Type" to "Code Signing"
3.3 Check the flag "Let me override defaults"
3.4 Click several times on "Continue" until you get to the "Specify a Location For The Certificate screen" then set Keychain to "System"
3.5 If you can't store the certificate in the "System" keychain, create it in the "login" keychain, then export it. You can then import it into the "System" keychain.
3.6 Make sure you have the "gdb-cert" in your "System" (left top window)
Select "Get Info" by pressing twice on the fresh made certificate (gdb-cert),
Open the "Trus"t item, and set "Code Signing to Always Trust"
Close Keychain Access application
Restart "taskgated" application from activity monitor
Now you need to sign the Certificated by doing from terminal
$ codesign -s gdb-cert ../path of GDB
Example:
$ codesign -s gdb-cert /usr/local/bin/gdb
You are all set now.... ready to debug you C/C++ application on Eclipse on MacOSX Mavericks
Make sure you have all set properly once again double check on Eclipse Menu Run->Debug Configuration->Debugger the line :
GDB Debugger -> /usr/local/bin/gdb (or your local path, check it with "$ which gdb" to get the correct path)
GDB Command file-> .gdbinit
Apple let GDB installed on the Mavericks but they like people squash their heads on the wall before doing a simple Hallo World program. No comment.
Have Fun and I hope to have saved you time!

No Make or GCC on my OSX

I'm new with OSX. When I open a terminal I don't have make or gcc; however I have installed xcode so from what I have read they should by somewhere on the OS.
What should I do?
Go to the Apple Developer website, log in and then look for "Command Line Development Tools". They should be found at https://developer.apple.com/downloads.
Logging in is important as you need to do this to get access to these specific tools.

Xcode debugger: cmd line application - start with sudo?

I need to debug a command line application with Xcode...
and I need to have the debugger launch my app with 'sudo'.
How do I tell Xcode to do that?
thx->adv
Running XCode as root is a bad idea.
There is an option for this in XCode (6.2):
Product -> Scheme -> Edit Scheme
Select the "Run" configuration
Change the radio button for "Debug Process As" to "root"
Have you tried starting Xcode with sudo?
The processes it spawns (gdb,...) should also run with superuser privileges:
sudo /Applications/Xcode.app/Contents/MacOS/Xcode
You could launch XCode itself with sudo, then it will be running with the privileges of your nominated user, and also your application would run with the same privileges.
This may not be the best way; there may be a way to tell XCode to launch your application in a particular way. But the above method will work in any case.

Resources