This might be a stupid question and I apologize if it's already been addressed here, but I've searched quite a bit without much luck. I'm trying to get my interface's hardware address in C and I'm using OS X (x86-64). I know how to get it with ifconfig
, but I want my program to get it automatically for any computer, well, at least OS X computers. I found another thread that posted this link which pretty much does what I want (with some modifications), but I can't make the iokit
functions link in ld
(my compiler is gcc
). I tried adding the flags -lIOKit
and -framework IOKit
to the gcc
command line, but I still get the same link errors. Here's a link to my code: header and source.