The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   UNIX - General (http://hintsforums.macworld.com/forumdisplay.php?f=16)
-   -   list all applications installed on mac using shell script (http://hintsforums.macworld.com/showthread.php?t=114715)

himanshu 11-04-2010 06:39 AM

list all applications installed on mac using shell script
 
I need a shell script using that I can get list of all applications installed on
mac

I also need to enter IP , for perticular IP I need to find out list of applications for that mac
for ex:
mdfind echo /Applications/ -ls
will give me list of all apps installed on my mac at path HD:Applications

I also want to find out for entering IP
for ex:
mdfind 10.0.0.0 echo /Applications/ -ls

above is structure,I need out put as above

renaultssoftware 11-04-2010 08:00 AM

What IPs are you looking to find? Local, or "out there" on the Internet?

You might be able to connect with ssh or telnet, however I'm clueless about those.

Hopefully some senior member can come and help.

Have you searched the web for this already?

regulus6633 11-04-2010 08:01 AM

I would use the system_profiler command line tool. It will give you all applications, not just the ones in the /Applications folder. This will do it...
Code:

system_profiler SPApplicationsDataType
In order to get that information from another computer you'll have to login to it using ssh first, then run the command.

Hal Itosis 11-04-2010 11:06 AM

Quote:

Originally Posted by regulus6633 (Post 600085)
I would use the system_profiler command line tool. It will give you all applications, not just the ones in the /Applications folder. This will do it...
Code:

system_profiler SPApplicationsDataType
In order to get that information from another computer you'll have to login to it using ssh first, then run the command.

Wow, that system_profiler command should do the trick (albeit quite slowly, with a lot of detailed output). But for some reason it acts a bit strange on my new MBP (core i7, OS 10.6.4). It puts out a few lines like this, before printing any results:

CoreEndianFlipData: error -4940 returned for rsrc type DITL (id 134, length 125, native = no)
SystemFlippers: didn't consume all data for vers ID 1 (pBase = 0x10a551640, p = 0x10a55166f, pEnd = 0x10a551670)



OTOH, Spotlight's index is quite speedy. You'd be surprised how much this produces in under a tenth of a second:

mdfind 'kMDItemContentTypeTree == com.apple.application'

tlarkin 11-04-2010 12:10 PM

To help speed up the system_profiler command line binary you can use the detailLevel -mini switch on it, or use the find command for anything with an .app suffix. Unless you want to find applications specifically in the /Applications folder. Be aware that Apple puts lots of apps all over the place.

Hal Itosis 11-05-2010 04:26 AM

Quote:

Originally Posted by tlarkin (Post 600099)
To help speed up the system_profiler command line binary you can use the detailLevel -mini switch on it, or use the find command for anything with an .app suffix. Unless you want to find applications specifically in the /Applications folder. Be aware that Apple puts lots of apps all over the place.

I believe the intent behind -detailLevel mini is to omit personal information (such as user's real name and hardware serial numbers). While it's true that less output happens for some data types (i.e., full > basic > mini) generally speaking... it seems however that the SPApplicationsDataType reports appear identical in this regard...

Code:


$ time system_profiler -detailLevel mini SPApplicationsDataType 2>/dev/null |wc -l
  13881

real        0m5.371s
user        0m1.855s
sys        0m0.859s

$ time system_profiler SPApplicationsDataType 2>/dev/null |wc -l
  13881

real        0m5.567s
user        0m1.873s
sys        0m0.885s

...i.e., same number of lines of output, and no (significant) speed improvement.

BTW, those runs were done after a few reports had already been generated (i.e., some of the data was probably cached). The *original* (cold start) run took 17 seconds on my new Core i7 MBP.

Also, the output format (mini or not mini) is like this...
Code:


    OneClick 2:

      Version: 5.5.1
      Last Modified: 11/21/99 10:22 PM
      Kind: Classic
      Get Info String: InstallerVISE 5.5.1
      Location: /Volumes/Storage/NDL/special/OneClick/OneClick 2.0 Installer (MS)

...so using system_profiler will likely require additional filtering of the results. (e.g., grep 'Location:' or something).

himanshu 11-09-2010 01:17 AM

IPs only my for Intranet
 
Quote:

Originally Posted by renaultssoftware (Post 600084)
What IPs are you looking to find? Local, or "out there" on the Internet?

You might be able to connect with ssh or telnet, however I'm clueless about those.

Hopefully some senior member can come and help.

Have you searched the web for this already?


I have Intranet app, I need to know list of all app installed on that particular PC or mac by shell script or apple script

I can find out all apps installed on my mac using mdfind echo /Applications/ -ls this type of command

I need to know list for example: mdfind echo /Applications/ IP Address -ls
Timer.app skype.app
MySql.app Mail.app
VNC.app

Hal Itosis 11-09-2010 04:46 AM

Quote:

Originally Posted by himanshu (Post 600438)
I can find out all apps installed on my mac using
mdfind echo /Applications/ -ls
this type of command

Hmm, that one doesn't work for me. [echo???]
Did you try mine yet? [from post #4]

himanshu 11-09-2010 05:51 AM

find install apps in mac by IP
 
Quote:

Originally Posted by Hal Itosis (Post 600448)
Hmm, that one doesn't work for me. [echo???]
Did you try mine yet? [from post #4]

i m giving examples and format like this , this is not exact , i m trying soon i will post it
"ls echo /Applications" works, I need this for other IP, to check required applications are installed on that PC or MAC or not

renaultssoftware 11-09-2010 07:30 AM

Himanshu, we're trying to help you, and you won't try our script? What is the point of posting here?

I don't think you can use this script for PC.

The echo command here is superfluous, why are you using it?

tlarkin 11-09-2010 10:08 AM

Well if the PC runs Linux you can probably use shell code on both platforms, if it runs windows you can try the power shell, which is very "Unix-like," but the syntax does not transfer from a non Windows system to a Windows system.

what exactly is it you are trying to accomplish? You need to see if an application is installed and you need the IP of the machine? Then you need that info output to a log or what?

himanshu 11-10-2010 02:47 AM

more explain this thread , search all installed apps on other mac or PC
 
Quote:

Originally Posted by renaultssoftware (Post 600463)
Himanshu, we're trying to help you, and you won't try our script? What is the point of posting here?

I don't think you can use this script for PC.

The echo command here is superfluous, why are you using it?

Are Sir,
I try your below script, this is some hi-fi,may be I am unable to post thread properly , I just need search all applications on other mac or window pc by using command "ls echo /Applications" + IP address for that machine ,

I check all check boxes in "Sharing" such as remote login, apple remote desktop, FTP access

and I use all your scripts mentioned in this thread
I am using widgetTerm 1.5 and "echo" is working fine in this widget

Hal Itosis 11-10-2010 03:07 AM

Quote:

Originally Posted by himanshu (Post 600570)
I try your below script, this is some hi-fi,may be I am unable to post thread properly , I just need search all applications on other mac or window pc by using command "ls echo /Applications" + IP address for that machine ,

and I use all your scripts mentioned in this thread
$ time system_profiler -detailLevel mini SPApplicationsDataType 2>/dev/null |wc -l

Not that one. (i was actually arguing against system_profiler when i posted that).

See post #4 for this command:

mdfind 'kMDItemContentTypeTree == com.apple.application'

BTW, i don't claim to know how to solve your *entire* problem. [nor do i quite understand how/why such a search would be used, across an entire network... and have the results returned in terms of IP numbers. Hmm, perhaps rsync could be configured to carry out such a scheme?]


Quote:

Originally Posted by himanshu (Post 600570)
I check all check boxes in "Sharing" such as remote login, apple remote desktop, FTP access.

Sorry, i'm not ready to get that adventurous yet. :)
I was just trying to offer more practical syntax for mdfind (i.e., besides 'echo' and '-ls')

himanshu 11-10-2010 04:25 AM

script not working
 
1 Attachment(s)
I tried
mdfind 'kMDItemContentTypeTree == com.apple.application'

this is not working at all no output (pic is attach)
I mean to say, I want a list on your mac contains all applications installed in application folder on HD
I only know your IP address of machine,
how can i do with shell script?

himanshu 11-10-2010 05:19 AM

search apps on other mac
 
Quote:

Originally Posted by himanshu (Post 600578)
I tried
mdfind 'kMDItemContentTypeTree == com.apple.application'

this is not working at all no output (pic is attach)

if i copy paste your text in red in terminal it works
mdfind 'kMDItemContentTypeTree == com.apple.application'

I do not know what is problem....
I mean to say, I want a list on your mac contains all applications installed in application folder on HD
I only know your IP address of machine,
how can i do with shell script?

I want for all other PCs in my intranet work available

renaultssoftware 11-10-2010 07:23 AM

Hey wait. PC or Mac?

Before you use mdfind you must run this in the Terminal:
Code:

cd /
Then you'll be set.

hayne 11-10-2010 09:54 AM

Quote:

Originally Posted by renaultssoftware (Post 600588)
Before you use mdfind you must run this in the Terminal:
Code:

cd /

Wrong.
'mdfind' does not search the current directory - it merely queries the Spotlight database.

Having Spotlight enabled is of course a requirement. I suspect that is the reason why himanshu didn't get any results.

tlarkin 11-10-2010 09:58 AM

Quote:

Originally Posted by hayne (Post 600601)
Wrong.
'mdfind' does not search the current directory - it merely queries the Spotlight database.

Having Spotlight enabled is of course a requirement. I suspect that is the reason why himanshu didn't get any results.

Not only that, but your hard drive probably has to be indexed on top of that. I don't use spotlight so I am not 100% on that one.

hayne 11-16-2010 04:01 AM

I don't see what is wrong with the previous suggestion to use 'mdfind' (after ssh-ing into the remote machine).

himanshu 11-16-2010 04:18 AM

i found last for local machine,want script by IP
 
1 Attachment(s)
there is freeware as :http://www.belarc.com/ for windows and need same for mac
i have got ssh "10.0.0.40" sudo find /Applications -name "*.app" modify for search by IP address
u r ssh-ing script I can not understand

Dear Friends,
I m closer, I attach a PIC now I just want 10% from you
pls help this thread can close in next 24 hrs,
I entered correct password but not going forward

hayne 11-16-2010 04:21 AM

Quote:

Originally Posted by himanshu (Post 601174)
i want for network macs by giving IP

I repeat my question: what is wrong with just using 'ssh' to login to the remote Mac and then run that command?

himanshu 11-16-2010 05:06 AM

can not understan
 
Quote:

Originally Posted by hayne (Post 601172)
I don't see what is wrong with the previous suggestion to use 'mdfind' (after ssh-ing into the remote machine).

Hello Sir,
I can not understand, ssh-in on remote mahcine
pls take some efforts to elaborate

I found sudo find / -name "*.app" gives u list of all apps on ur machine

how to do remoting that I can not understand , I try all ur above answers
I want simple one line script consist IP address, currently I have list of IPs in excel format

hayne 11-16-2010 05:48 AM

Start here:
http://www.google.ca/search?q=how+to+use+ssh
But you need to expect to spend several hours (or days) reading and learning concepts - not just looking for the exact solution to your current problem.

himanshu 11-17-2010 08:37 AM

hayne..pls see my #20 no thread...I use ssh there...pls refer that open that PIC use your IP address there and check this and post reply

hayne 11-17-2010 10:48 AM

That screencapture shows that you failed to login remotely on the other machine using 'ssh'. That is a separate problem that you will need to solve. Do you have an account on that machine? (You will need one.)

himanshu 11-18-2010 04:42 AM

do u want to suggest something else ?
 
Quote:

Originally Posted by hayne (Post 601318)
That screencapture shows that you failed to login remotely on the other machine using 'ssh'. That is a separate problem that you will need to solve. Do you have an account on that machine? (You will need one.)

yes account is there, I have the current user id and pass of that machine
and I also have admin pass to connect as admin
but the pass is not accepted and i can not log in
can u focus light more on that written shell command
using ssh, do u want to suggest something else

hayne 11-18-2010 05:47 AM

To use 'ssh', you have to enable "Remote Login" in Sharing Preferences on the remote machine.

Hal Itosis 11-18-2010 07:11 AM

or ask the [actual] owner to do it. ;)

himanshu 11-18-2010 08:17 AM

i was done that before
 
hi hayne,
as per mclbruce said i was done enable option http://www.dssw.co.uk/blog/2007/05/1...-mac-os-x-104/
and then post thread here

renaultssoftware 11-18-2010 06:47 PM

So you did. Are the two Macs (they should be) on the same network?

renaultssoftware 11-18-2010 06:54 PM

Quote:

Originally Posted by himanshu (Post 601174)
there is freeware as :http://www.belarc.com/ for windows and need same for mac
i have got ssh "10.0.0.40" sudo find /Applications -name "*.app" modify for search by IP address
u r ssh-ing script I can not understand

Dear Friends,
I m closer, I attach a PIC now I just want 10% from you
pls help this thread can close in next 24 hrs,
I entered correct password but not going forward

I see your error. Is the account name the same on the first computer and the other? If not, try this:
Code:

ssh -l <username> <ip_address>
Of course, replace the <username> with your actual username, and <ip_address> with the correct IP (say 10.4.201.221).

himanshu 11-19-2010 04:16 AM

i was done..no progress
 
2 Attachment(s)
Quote:

Originally Posted by renaultssoftware (Post 601474)
I see your error. Is the account name the same on the first computer and the other? If not, try this:
Code:

ssh -l <username> <ip_address>
Of course, replace the <username> with your actual username, and <ip_address> with the correct IP (say 10.4.201.221).

of course...i know that uid and pass...there are no 2 macs on same network..
i have done ur above script also..no progress...snap shot is attached.....there may be network issue
but as i use VNC i m able to connect that site without err...

hayne 11-19-2010 04:29 AM

Try it again by with the "-v" option this time - that will give more info about what is going wrong.

ssh -v -l dump 10.0.0.40

himanshu 11-19-2010 04:31 AM

OK I enter
 
1 Attachment(s)
OK boss I enter

showing err that attached in pIC...now
can i enter password...or exit

It has been given warning as data or system files will be lost
what to do?

hayne 11-19-2010 04:35 AM

Umm, what you showed is just the standard warning that is issued the first time a user account uses 'sudo'. You haven't seen this before???

Anyway, why are you using 'sudo' ? Let's concentrate on getting 'ssh' working. Don't run any commands in the 'ssh' line, just get a remote login session.

himanshu 11-19-2010 04:35 AM

no getting
 
2 Attachment(s)
Quote:

Originally Posted by hayne (Post 601510)
Try it again by with the "-v" option this time - that will give more info about what is going wrong.

ssh -v -l dump 10.0.0.40

i try above and ssh -v -l dump 10.0.0.40...this way we can not achieve result

means instead of sudo i have to use ssh ...


I take two stpes from now: as attach in *.doc :
at last instead of writing exit if Can I continue with command
(dump$ sudo find/Applications -type f -name "*.app") then will
it give me all application list on dump mac

post me reply..take u r time...(warning can distory connection or data on dump)...and i do not know how
to anything more

himanshu 11-19-2010 05:56 AM

prob for command + K
 
1. after doing above scripting from terminal
there is prob for finder command + K
this window is hanged and afp:// links in
text box is hanged...i need to log out from system

2. i tried above command and unable to view list of all apps on 10.0.0.40
i can success remote login but unable to find installed apps on 10.0.0.40

himanshu 11-19-2010 09:18 AM

thread is solved
 
after remote login is successful
i use command
ls -l /Applications

this gives me all apps installed on remote mac
and then i start VNC and take a snap shot
and identify both are found to be correct

i close this thread here itself

himanshu 11-19-2010 09:34 AM

yes this is working
 
2 Attachment(s)
Quote:

Originally Posted by hayne (Post 601510)
Try it again by with the "-v" option this time - that will give more info about what is going wrong.

ssh -v -l dump 10.0.0.40

hayne...this is extremly nice..above u r link is working at this time
i found one thing as u said ssh -v -l dump 10.0.0.40 done same job as ssh -l dump 10.0.0.40
"-v" is not necessary

1.ssh -v -l dump 10.0.0.40
password:xxxx
2.ls -l /Applications..............(log in one list191110.txt)

3.open VNC viewer and remote login,open finder->Applications->take snap shot
.......(PIc file list191110.png)

both tally they are found to be correct...

I want to do more R&D....I will let u know.....thanks hayne......very much:D

himanshu 11-19-2010 10:25 AM

how to chek which OS is there on remote machine
 
Dear hayne,

i am digging how to find which os x,firefox,email agent(mac mail,entourge) version is there on remote machine by shell script

Hal Itosis 11-19-2010 12:34 PM

Quote:

ls -l /Applications
this gives me all apps installed on remote mac
Surely you jest.
What about stuff in the Utilities folder?
[e.g., Terminal.app]

himanshu 11-22-2010 01:56 AM

yes...right now not required
 
Quote:

Originally Posted by Hal Itosis (Post 601551)
Surely you jest.
What about stuff in the Utilities folder?
[e.g., Terminal.app]

yes...u r right....generally system tool and freewares are there in that folder..so no need to go there..but u r point is accpected...this is just tentative...now I an checking.....for perticular app...I need...details...if license copy is there....then its num......installation date (as properties of perticular app)

himanshu 11-23-2010 08:28 AM

hi..some advance..help
 
hi,

i m getting apps installed on other mac remotely using above
but i want to get license no....and other detail properties...not getting any help..!!!

tlarkin 11-23-2010 09:53 AM

Quote:

Originally Posted by himanshu (Post 601801)
hi,

i m getting apps installed on other mac remotely using above
but i want to get license no....and other detail properties...not getting any help..!!!

Ok, so you need the license keys from these apps? You aren't being clear on what you need. Sometimes license keys are stored in plain text files, like plist files, but not always.

Each and every app will be different as well.

himanshu 11-24-2010 03:50 AM

ok this is nice
 
ok this is nice i would like to know about .plist
what .plist file i suppose to get open and read key

for text file i will gather information and let u know, but first i will search

renaultssoftware 11-24-2010 08:02 AM

It varies greatly. We probably don't have all your software, so bear with us.

himanshu 11-24-2010 10:07 AM

i will try my best
 
i will try my best and I know at last moment u and hayne are there (Professional Swimmers) get me out....!!!!!!

renaultssoftware 11-24-2010 08:37 PM

Quote:

Originally Posted by himanshu (Post 601910)
(Professional Swimmers) get me out....!!!!!!

I do have a Red Cross Level 6 badge, but I'm not a competition person like my friends. ;)

From what I know, some apps have .lic files. One app's (no prizes for guessing its name) file format is .windowFlowLicense :)

Either way, I'd like to know what you want the licenses for.

renaultssoftware 12-11-2010 08:03 AM

Come again? I don't quite understand your query.


All times are GMT -5. The time now is 06:05 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.