Skip to content

Instantly share code, notes, and snippets.

View micahculpepper's full-sized avatar

Micah Culpepper micahculpepper

View GitHub Profile
@micahculpepper
micahculpepper / get_user.sh
Created October 27, 2021 18:08
Find the logged-in user on MacOS
#!/usr/bin/bash
RUID=$(id -ru)
RGID=$(id -rg)
# Find logged in user via the Python -> Objective C bridge
# Docs: https://pythonhosted.org/pyobjc/apinotes/SystemConfiguration.html
output=$(cat << EOF | /usr/bin/python -
import sys
from SystemConfiguration import SCDynamicStoreCopyConsoleUser

Keybase proof

I hereby claim:

  • I am micahculpepper on github.
  • I am micahculpepper (https://keybase.io/micahculpepper) on keybase.
  • I have a public key ASCQeL5hbZr4s1ViStKLAh1cwzBm3D9ZdDSigjXMAQbfvAo

To claim this, I am signing this object: