Look up an macOS application's bundle ID #
Paste this function in a command-line terminal, or store it in a file (e.g., in a directory in $PATH
, for example: ~/bin/
).
1function app2bundle {
2 osascript -e "id of application \"$1\"" 2>/dev/null || { \
3 echo "no results found for \"$1\"" 1>&2; \
4 return 1; \
5 };
6}
example usage #
A few examples for succesful lookups:
1app2bundle spotify
2# ➜ com.spotify.client
1app2bundle 'visual studio code'
2# ➜ com.microsoft.VSCode
1app2bundle 'vscodium'
2# ➜ com.visualstudio.code.oss
And a failure lookup:
1app2bundle fakeapp
2# ➜ no results found for "fakeapp"