I occasionally need to help one of our customers get the bundle identifier for a given app, for some purpose with one of our apps. While the task isn’t complicated—the value is stored in a file named Info.plist within each app bundle—it’s not something that’s necessarily easy to explain to someone who doesn’t have a lot of Mac experience.
I figured there must be a less-complicated solution, and I was right, though it’s probably higher on the geek factor. After some searching, I found this thread at Super User, which offers a number of solutions. The simplest—and always working, in my experience—was the very first one: Open Terminal and run this command:
osascript -e 'id of app "Name of App"'
The "Name of App" is replaced with the name of the app as it appears when hovering over its Dock icon. For Excel, for example, it’d be:
osascript -e 'id of app "Microsoft Excel"'
Run that command, and it returns com.microsoft.Excel, which is just what I need—I just have the customer copy the output and email it back to me.