Mac で serial numberを調べる時

Contributed by: akira on 2010年11月10日(水) 23:16 JST

Last modified on

www.jaharmi.com/2008/03/15/get_uuid_for_mac_with_ioreg[*1]  

シリアルナンバーを調べる時のコマンド ioreg で取り出せる。

Get the UUID for a Mac with ioreg
Sat, 2008-03-15 16:04 — Jaharmi
UUIDs, used throughout the rest of Mac OS X for identifying disks and users and groups and whatnot, have now become the unique identifier for ByHost preferences. Or so I’ve been informed, in this article on the topic at AFP548[*2] , which told me that Ethernet hardware addresses are no longer en vogue for this purpose in Leopard.
So, to get the UUID for your Mac you can do the following step suggested in the article:
$ ioreg -rd1 -c IOPlatformExpertDevice | grep -E '(UUID)'
"IOPlatformUUID" = "10703BFC-6664-40C5-9331-E73FCE2C2E29"
Let’s expand upon this for a moment. Switch that grepping over to awk, and you get:
$ ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { print $3; }'
"10703BFC-6664-40C5-9331-E73FCE2C2E29"
Note that you can strip the quotes in the same manner I did with serial numbers from ioreg[*3] :
$ ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { split($0, line, "\""); printf("%s\n", line[4]); }'
10703BFC-6664-40C5-9331-E73FCE2C2E29
Well, that’s it. I’m not going to launch into any long performance analysis of this … at least, not right now.
コメント (0件)

Geeklog Site - Mac で serial numberを調べる時
https://geeklog.craine.ne.jp/article.php?story=20101110231624538

[*1] http://www.jaharmi.com/2008/03/15/get_uuid_for_mac_with_ioreg
[*2] http://www.afp548.com/article.php?story=leopard_byhost_changes
[*3] http://www.jaharmi.com/freelinking/To%20get%20Mac%20serial%20numbers%20in%20scripts%2C%20is%20ioreg%20or%20system_profiler%20faster%3F