2013-03-01 3 views
7

나는 (맥) OS X의 시스템에 설치된 모든 응용 프로그램, LaunchServices에 등록 즉, 모든 응용 프로그램 번들을 열거하는 솔루션을 찾고 있어요

기본 문제. 열거 설치된 모든 응용 프로그램

작동하지 않았다

간단한 방법 (참고 : lsregister/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister에서 찾을 수 있습니다). 현재 내가 몇 가지 문제가 lsregister -dump | grep -E '^.*[ \\t]*path:[ \\t]+(\/.*)$' | grep -Eo '\/.*'의 출력, 사용하고

: 올바르게 처리되지 않습니다 (UNIX에서만 유효 \n)

  • .app 번들 줄 바꿈과을 (이 문제는 서면으로 고칠 것 적절한 파서)
  • lsregister은 이상한 파일명 (예 : RTL mark 포함)을 올바르게 처리하지 못합니다. lsregister은 RTL 마크가있는 파일을 무시하는 것 같습니다. 원하는 경우 다음 명령을 실행하여 이름에 RTL이있는 파일을 만들 수 있습니다.

    python -c 'import shutil; shutil.copytree(u"/Applications/TextEdit.app", u"/Applications/ThisIsAWeird\u202EApp.app")' 
    

    이 작업을 수행 한 후, lsregister -dump | grep ThisIsAWeird를 공개하지 것입니다. 그러나 텍스트 파일을 마우스 오른쪽 버튼으로 클릭하고 "연결 프로그램"으로 이동하면 LaunchServices와 Finder가 해당 파일을 계속 지원합니다. see yourself

단순히 /Applications에있는 모든 파일을 열거하고 LaunchServices 임의의 폴더에 응용 프로그램 번들 알고 나는 이러한 애플 리케이션을 필요로하기 때문에 다른 디렉토리가 작동하지 않습니다.

내가 분명히

일을하지 않았다

다른 approch, 나는 할 필요가 정확히 않는 _LSFindApplications라는 개인 API 함수있다 하지만 난 그게 동작하지 않습니다 어떤을 찾을 수 없습니다 인터넷상의 비공식 문서. (증거가 존재합니다 nm /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/LaunchServices | grep __LSFindApplications$를)

UPDATE : lsregister 여전히 더 집어 들고 있음을 system_profiler 방법은 내가하지만 오늘은 발견 @Anoop에 의해 제안으로 system_profiler 방법은 작품 불구하고 지금까지

를 작동하지 않는 것 바이너리. 일부 또는 모든 컴퓨터에서 누락 된 일부는 system_profiler에 누락 된 것 같습니다. 다른 볼륨에 OS X을 설치하면 외장 볼륨이 누락되었을 수 있습니다. 다음은 system_profiler의 출력에서 ​​누락 된 목록입니다 (단, lsregister에 있음). 기계 :

/Applications/Automator.app/Contents/Resources/Application Stub.app 
/Applications/Google Chrome.app/Contents/Versions/30.0.1599.69/Google Chrome Framework.framework/Resources/app_mode_loader.app 
/Applications/Google Chrome.app/Contents/Versions/30.0.1599.69/Google Chrome Framework.framework/Resources/crash_report_sender.app 
/Applications/Google Chrome.app/Contents/Versions/30.0.1599.69/Google Chrome Helper EH.app 
/Applications/Google Chrome.app/Contents/Versions/30.0.1599.69/Google Chrome Helper NP.app 
/Applications/Google Chrome.app/Contents/Versions/30.0.1599.69/Google Chrome Helper.app 
/System/Library/CoreServices/AddPrinter.app 
/System/Library/CoreServices/AirPlayUIAgent.app 
/System/Library/CoreServices/AppleFileServer.app 
/System/Library/CoreServices/AppleGraphicsWarning.app 
/System/Library/CoreServices/AppleScript Runner.app 
/System/Library/CoreServices/AppleScript Utility.app 
/System/Library/CoreServices/CalendarFileHandler.app 
/System/Library/CoreServices/Certificate Assistant.app 
/System/Library/CoreServices/CoreLocationAgent.app 
/System/Library/CoreServices/CoreServicesUIAgent.app 
/System/Library/CoreServices/CoreTypes.bundle 
/System/Library/CoreServices/Database Events.app 
/System/Library/CoreServices/DiskImageMounter.app 
/System/Library/CoreServices/Expansion Slot Utility.app 
/System/Library/CoreServices/File Sync.app 
/System/Library/CoreServices/FileSyncAgent.app 
/System/Library/CoreServices/Folder Actions Dispatcher.app 
/System/Library/CoreServices/Folder Actions Setup.app 
/System/Library/CoreServices/HelpViewer.app 
/System/Library/CoreServices/Image Events.app 
/System/Library/CoreServices/Install in Progress.app 
/System/Library/CoreServices/Jar Launcher.app 
/System/Library/CoreServices/Java Web Start.app 
/System/Library/CoreServices/KeyboardSetupAssistant.app 
/System/Library/CoreServices/Language Chooser.app 
/System/Library/CoreServices/LocationMenu.app 
/System/Library/CoreServices/MRTAgent.app 
/System/Library/CoreServices/Memory Slot Utility.app 
/System/Library/CoreServices/NetAuthAgent.app 
/System/Library/CoreServices/Network Diagnostics.app 
/System/Library/CoreServices/Network Setup Assistant.app 
/System/Library/CoreServices/ODSAgent.app 
/System/Library/CoreServices/Pass Viewer.app 
/System/Library/CoreServices/Printer Setup Utility.app 
/System/Library/CoreServices/RegisterPluginIMApp.app 
/System/Library/CoreServices/Screen Sharing.app 
/System/Library/CoreServices/SecurityAgent.app 
/System/Library/CoreServices/SecurityFixer.app 
/System/Library/CoreServices/SocialPushAgent.app 
/System/Library/CoreServices/System Events.app 
/System/Library/CoreServices/System Image Utility.app 
/System/Library/CoreServices/SystemUIServer.app 
/System/Library/CoreServices/Ticket Viewer.app 
/System/Library/CoreServices/UniversalAccessControl.app 
/System/Library/CoreServices/UnmountAssistantAgent.app 
/System/Library/CoreServices/UserNotificationCenter.app 
/System/Library/CoreServices/VoiceOver.app 
/System/Library/CoreServices/ZoomWindow.app 
/System/Library/CoreServices/backupd.bundle/Contents/Resources/TMLaunchAgent.app 
/System/Library/CoreServices/loginwindow.app 
/System/Library/CoreServices/rcd.app 
/System/Library/Frameworks/PubSub.framework/Versions/A/Resources/PubSubAgent.app 
/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/QuickLookUI.framework/Versions/A/Resources/QuickLookUIHelper.app 
/System/Library/Frameworks/QuickLook.framework/Versions/A/Resources/quicklookd.app 
/System/Library/PrivateFrameworks/DiskImages.framework/Versions/A/Resources/DiskImages UI Agent.app 
/System/Library/Services/AppleSpell.service 
/System/Library/Services/ChineseTextConverterService.app 
/System/Library/Services/ImageCaptureService.app 
/System/Library/Services/OpenSpell.service 
/System/Library/Services/SpeechService.service 
/System/Library/SocialServices/Facebook.socialplugin 
/System/Library/SocialServices/Twitter.socialplugin 
/System/Library/SocialServices/Weibo.socialplugin 
+1

RCDefaultApp을 사용하기 때문에이 방법이 가능하다는 것을 알고 있습니다.하지만 어떻게해야할지 모르겠습니다. – zneak

답변

4

첫째, 당신의 요구는 매우 옳지 않다 : 나는 (맥) OS X의 시스템에 설치된 모든 응용 프로그램, LaunchServices에 등록 즉, 모든 응용 프로그램 번들을 열거하는 솔루션을 찾고 있어요

.

이들은 같은 것이 아닙니다. LaunchServices에 등록 된 응용 프로그램 번들은 lsregister -dump의 출력입니다. 이는 "설치된 모든 응용 프로그램"과 같은 것은 아닙니다. "설치된 모든 응용 프로그램"에 대한 정확한 쿼리는 없습니다. OS X은 실제로 그런 개념을 가지고 있지 않습니다.

system_profiler의 출력은 Spotlight가 알고있는 것과 같습니다. 이는 설치된 응용 프로그램의 전체 목록이 아니며 여러 경우에 올바르지 않을 수 있습니다. 예를 들어 스포트라이트가 사용 중지되었거나 첫 번째 스캔을 완료하지 않았을 수 있습니다. (Spotlight가 첫 번째 스캔을 완료했는지 묻는 지원되는 방법은 없습니다 (레이더 15177626)

pkgutil --pkgs 또한 "설치 한 것"을 추가로 제공합니다. 그것은 완전하지도 않고 설치되지 않은 것을 나열 할 수도 있습니다.

mdfind을 사용하여 전체 디스크를 걸러 내고 응용 프로그램 자체를 호출 할 수 있습니다. 이것은 꽤 효과적이지만 느립니다.

locate .app | grep '\.app$'도 사용할 수 있습니다.이 데이터베이스는 데이터베이스를 최신으로 유지하고 앱 번들 만 원할 경우 매우 효과적입니다.

나는 애플에게 WWDC에서 이것에 관해 물었다. 단순하고 지원되는 대답은 없습니다. 레이더를여십시오. 당신은 터미널에서 15177489.

1

코코아 애플리케이션/코드를 완료로 사용하는 경우는 here입니다.

또한 system_profiler -xml SPApplicationsDataType을 사용하고 결과 XML 데이터를 구문 분석하여 관심있는 응용 프로그램 만 얻을 수 있습니다.

+0

은 오늘'lsregister'가'system_profiler'보다 더 많은 것을 선택했다고 오늘 발견했습니다 :-(. –

1

속는 요청할 수 있습니다 :

system_profiler SPApplicationsDataType > list_of_all_apps.txt

는 ... 텍스트 파일에 system_profiler 쿼리의 출력을 기록합니다.