MacOS下查找应用程序的Bundle Identifier

MacOS下,在使用squirrel(即rime的macOS版本)时,如果想让某一程序默认输入法状态是英文,则可以在squirrel.custom.yaml里做相应的设置,例如:

1
2
3
4
5
6
# --- 特定程序定义初始状态的英文输入 ---
app_options:
com.raycast.macos: # Raycast
ascii_mode: true
com.googlecode.iterm2: # iTerm2
ascii_mode: true

但是这里有个问题,如果不知道目标应用程序的Bundle Identifier,则无法添加。

所以首要任务是找到目标应用程序的Bundle Identifier

在macOS里,查找Bundle Identifier的命令如下:

1
osascript -e 'id of app "应用名称"'

例如,要获取Termora这个ssh工具的标识符,就输入

1
osascript -e 'id of app "Termora"'

输出如下: