Mac OS X Reference Library Apple Developer Connection spyglass button

Version: 1.2

Posted: 2005-10-27

Build Requirements: Project Builder 2.1 or Xcode 2.1

Runtime Requirements: Mac OS X 10.2 or later

View Source Code:

Download Sample Code (“GetPrimaryMACAddress.zip”, 18.5K)



Description

This command-line tool demonstrates how to retrieve the Ethernet MAC address of the built-in Ethernet controller from the I/O Registry on Mac OS X. This is useful if you need a means of uniquely identifying a Macintosh system. Techniques shown include finding the primary (built-in) Ethernet interface, finding the parent Ethernet controller, and retrieving properties from the controller's I/O Registry entry.

This sample code has been updated to include a project that produces a universal binary. No code changes were required for it to run correctly on the Developer Transition Systems.

Document Revision History

Date Notes
2005-10-27Updated to produce a universal binary. No code changes were required. Use kIOMasterPortDefault instead of older IOMasterPort function. Print the MAC address to stdout in response to <rdar://problem/4021220>.
2003-01-14Demonstrates retrieving the MAC address of the built-in Ethernet controller. Useful for uniquely identifying a Macintosh system.
Did this document help you? Yes It's good, but... Not helpful...