55
27
One option would be to use AppleScript:
$ osascript -e 'id of app "Finder"'
com.apple.finder
You could also do something like this:
$ bundle=$(mdfind -onlyin / kMDItemKind==Application | grep -i "/Finder.app$" | head -1)
$ defaults read "$bundle/Contents/Info" CFBundleIdentifier
com.apple.finder
Both of these are fairly slow (about 0.05-0.2s on my Air) though. Are there any faster or less hacky options?
I like the
osascript
solution. How many times a second do you need to run this though? – arya – 2015-03-06T08:00:21.6931Using
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 – 2011-10-16T22:15:36.927