6

I get this annoying dialog when I login on my mac as a standard user, and I don't know why it keeps asking for an admin password.

enter image description here

My question is if there is a way to find out which command/process or whatever is causing this dialog. Thanks in advance

4
  • there are many things in macOS where you need to be an admin to make some changes in system files.
    – Udhy
    Commented Aug 24, 2020 at 15:43
  • Boot into Safe Mode (Hold Shift while booting). It will prevent 3rd party software and drivers from loading. Do you still get the admin password dialog?
    – Allan
    Commented Aug 24, 2020 at 16:59
  • What are your login items ? sys pref > Users & accounts > login items
    – anki
    Commented Aug 24, 2020 at 19:26
  • You cannot install anything on Mac without admin access Commented Aug 25, 2020 at 0:50

1 Answer 1

2

Credit to superuser answer for this.

There are certainly other ways to achieve this, but if you are clever with Python, here is a handy script that will show you pertinent details for currently displayed windows. After running, move the window in question, and the script will give you the specifics (e.g. PID) for that window. From there, you can poke around and see who is bugging you for su.

#!/usr/bin/env python

import Quartz
import time
from Foundation import NSSet, NSMutableSet
def transformWindowData(data):
    list1 = []
    for v in data:
        if not v.valueForKey_('kCGWindowIsOnscreen'):
            continue


        row = (  \
            str(v.valueForKey_('kCGWindowOwnerPID') or '?').rjust(7) + \
            ' ' + str(v.valueForKey_('kCGWindowNumber') or '?').rjust(5) + \
            '  {' + ('}' if v.valueForKey_('kCGWindowBounds') is None else \
                ( \
                    str(int(v.valueForKey_('kCGWindowBounds').valueForKey_('X')))     + ',' + \
                    str(int(v.valueForKey_('kCGWindowBounds').valueForKey_('Y')))     + ',' + \
                    str(int(v.valueForKey_('kCGWindowBounds').valueForKey_('Width'))) + ',' + \
                    str(int(v.valueForKey_('kCGWindowBounds').valueForKey_('Height'))) \
                ) + '}'  \
                ).ljust(21) + \
            '\t[' + ((v.valueForKey_('kCGWindowOwnerName') or '') + ']:') + \
            ('' if v.valueForKey_('kCGWindowName') is None else (" " + v.valueForKey_('kCGWindowName') )) \
        )
        list1.append(row)

    return list1;

def printBeautifully(dataSet):
    print ('PID'.rjust(7) + ' ' + 'WinID'.rjust(5) + '  ' + 'x,y,w,h'.ljust(21) + ' ' + '\t[Title]:SubTitle')
    print ('-'.rjust(7,'-') + ' ' + '-'.rjust(5,'-') + '  ' + '-'.ljust(21,'-') + ' ' + '\t-------------------------------------------')

    # print textList1
    for v in dataSet:
        print (v);

#grab initial set
wl = Quartz.CGWindowListCopyWindowInfo( Quartz.kCGWindowListOptionAll, Quartz.kCGNullWindowID)
wl = sorted(wl, key=lambda k: k.valueForKey_('kCGWindowOwnerPID'))

#convert into readable format
textList1 = transformWindowData(wl);

#print everything we have on the screen
print ('all windows:')
printBeautifully(textList1)

print ('Move target window')
time.sleep(5)

#grab window data the second time
wl2 = Quartz.CGWindowListCopyWindowInfo(Quartz.kCGWindowListOptionAll, Quartz.kCGNullWindowID)
textList2 = transformWindowData(wl2)

#check the difference
w = NSMutableSet.setWithArray_(textList1)
w.minusSet_(NSSet.setWithArray_(textList2))

#print the difference
printBeautifully(w)

Note: This script is for Python 3.x. I fought with the original script for quite some time (I'm not a Python programmer). I couldn't get it to work (with 2.x) due to a Quartz dependency requiring 3.x.

A couple of prerequisites are:

pip install pyobjc-framework-Quartz
pip install quartz
1
  • 1
    Thanks a lot! I will definitely try this solution.
    – Samuel
    Commented Aug 25, 2020 at 8:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .