Auflisten aller installierten Anwendungen unter OS X

Grundlegendes Problem

Ich suche nach einer Lösung, um alle auf einem (Mac) OS X-System installierten Anwendungen aufzulisten, d. H. Alle bei registrierten AnwendungspaketeLaunchServices.

Einfacher Ansatz, der nicht funktioniert hat

(Bitte beachten Sie:lsregister finden Sie unter/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister).

Zur Zeit verwende ich die Ausgabe vonlsregister -dump | grep -E '^.*[ \\t]*path:[ \\t]+(\/.*)$' | grep -Eo '\/.*', was ein paar Probleme hat:

.app Bundles mit Newlines (\n, die unter UNIX gültig sind, werden nicht korrekt behandelt (Dieses Problem kann durch Schreiben eines geeigneten Parsers behoben werden.)

lsregister behandelt seltsame Dateinamen nicht richtig (z. B. mit demRTL-Zeichen).lsregister Scheint nur Dateien mit der RTL-Markierung im Namen zu ignorieren. Wenn Sie möchten, können Sie eine Datei mit RTL im Namen erstellen, indem Sie den folgenden Befehl ausführen.

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

Nachdem Sie dies getan haben,lsregister -dump | grep ThisIsAWeird werdennicht Zeige es. Wenn Sie jedoch mit der rechten Maustaste auf eine Textdatei klicken und auf "Öffnen mit" klicken, wird diese Datei von LaunchServices und Finder weiterhin unterstützt.

Einfach alle Dateien in auflisten/Applications und andere Verzeichnisse funktionieren nicht, da LaunchServices Anwendungspakete in beliebigen Ordnern kennt und ich diese Apps auch benötige.

Anderer Ansatz, den ich nicht zur Arbeit bekam

Anscheinend gibt es eine private API-Funktion namens_LSFindApplications Das tut genau das, was ich tun muss, aber ich kann es nicht zum Laufen bringen und habe keine inoffizielle Dokumentation im Internet gefunden. (Beweis, dass es existiert:nm /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/LaunchServices | grep __LSFindApplications$)

UPDATE: Die Methode system_profiler scheint ebenfalls nicht zu funktionieren

Bis jetzt habe ich aber diesystem_profiler Methode wie von @Anoop vorgeschlagen funktioniert, aber heute habe ich herausgefunden, dasslsregister nimmt noch mehr Binärdateien auf. Einige oder auf allen Maschinen fehlen, einige scheinen nur in zu fehlensystem_profiler Wenn Sie ein externes Volume mit einer anderen Installation von OS X gemountet haben. Hier ist eine Liste, was in der Ausgabe von fehltsystem_profiler (ist aber vorhanden inlsregister) auf einer meiner Maschinen:

/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

Antworten auf die Frage(3)

Ihre Antwort auf die Frage