Aniket
Aniket

Reputation: 131

how to find MAC address in MAC OS X programmatically?

I am new to Mac OS X and X code and want to know how to find the MAC address of a machine programmatically in OS X.

Upvotes: 2

Views: 10584

Answers (3)

Akansha
Akansha

Reputation: 132

Try below solution.

ifconfig en1 | awk '/ether/{print $2}'

Upvotes: -1

RARE Kpop Manifesto
RARE Kpop Manifesto

Reputation: 2815

for macOS 13.2 :

ifconfig en0 | mawk 'NF *= NF==2' FS='^[ \t]*ether ' OFS=
f8:4d:89:1a:73:d9

Upvotes: -1

sdc
sdc

Reputation: 3011

Bash Solution

ifconfig  | grep -A 6 en0 | grep -o ether.* | awk '{print $2}'

Upvotes: -1

Related Questions