How can I discover what apps are installed on OS X

2019-02-07 09:59发布

could you tell me please - which object and which method can i use to fetch information about installed applications on OSX with objective c or macruby?

7条回答
Bombasti
2楼-- · 2019-02-07 10:38
[[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:@"com.google.Chrome"];

This would return a path to Google Chrome app if it is installed, nil otherwise.

If you don't know the BundleID, there are two options to find it:

1) Open .plist file of the app by right-clicking the app icon and choosing Show Package Contents option.

Default path to Chrome .plist is /Applications/Google\ Chrome.app/Contents/Info.plist

2) Use lsregister alongside with grep.

Try typing the following into the Terminal app, you will find the BundleID there:

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -dump | grep -i chrome
查看更多
登录 后发表回答