$ osascript -e "id of app \"Finder\""
com.apple.finder

$ bundle=$(mdfind 'kMDItemKind==Application' | grep -i "/Finder.app$" | head -1)
$ defaults read "$bundle/Contents/Info" CFBundleIdentifier
com.apple.finder

Both are fairly slow (about 0.05-0.2s on my Air). Are there any faster or less hacky options?

link|improve this question

77% accept rate
Using defaults read seems like the right way to do it (or else querying LaunchServices via Obj-C) - why do you consider 0.1s slow? – Asmus Oct 16 '11 at 22:15
@Asmus It's slow because 100*0.1s = 10s. (Even though you could get them all in a single one osascript call or use a cache.) I don't know any Objective-C yet. – Lri Oct 17 '11 at 0:08
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.