Im writting a program that lists all the software installed in my mac. Where can I find t开发者_运维问答hat information? Thank you
You can call lsregister -dump
to get a list of all applications registered with Launch Services. The output will need to be parsed, though; each record has a path property that lists the full path to the application.
A simpler way would just be to scan /Applications
for all .app
bundles, as well as ~/Applications
for each user. That method wouldn't be guaranteed to get all applications, but it would be a pretty good start.
Open a terminal window and type ps -ef | grep 'java'
ps displays information about a selection of the active processes. ps -ef sees every process on the system using standard syntax. The pipe (|) sends the results to grep which allows you to search one file or multiple files for lines that contain a pattern. In this case the pattern is the word 'java'.
I've put this into an alias in my startup script so I can go it quickly.
精彩评论