OK, don't wanna use extra packages!
In my upnplib.pas I had a GetIPAddr() for Linux available.
Doesn't that work on Mac OS?
(uses unixtype and netdb)
I think it tries to connect to 127.0.0.1 port 53 and then sees with IP it uses.
I didn't write that and I'm not sure it would work on Mac but you can try.