List of Application installed in Android + Mac OS

Hi.
I need get the list of apps/packages installed in Android using command in Terminal.

Just like for android in windows:

final String _shellCommand = "/c adb shell pm list packages";
final String _command = "cmd.exe";
ProcessBuilder builder = new ProcessBuilder(_command, _shellCommand);

Above snippet displays all the packages installed in Android device.But i need to do same thing in Mac Environment.
1.Opening the Terminal.
2.Executing the adb command to get the list of packages.

Use ideviceinstaller, which should be installed if you’ve installed Appium through npm or source (not the app). Install instructions are also here:

http://macappstore.org/ideviceinstaller/

The command will be 'ideviceinstaller -u <uuid> -l'.

Thanks for the reply @wreed

But the command mentioned ideviceinstaller -u <uuid> -l throws error while running in Terminal like
Note:Am using simulator iPad Air,iOS 8.2

ideviceinstaller -u E16FF8F9-42DA-4051-BDEE-D13380F4AAC8 -l
ERROR: Invalid UDID specified
Usage: ideviceinstaller OPTIONS
Manage apps on iOS devices.

Need help on this!!!

Smaran,

adb shell pm list packages lists all packages including Android app packages also, right?

Is there anyway to get packages other than Android packages??

You didn’t state Simulator in your original post. In fact, here is what you said:

So next time try to state what you want. No one can help you if you can’t be bothered to ask a question in a way that pertains to your situation. The commands I gave you will work, with a device.

That said, there is no way to do this on Simulator.

Using Mac to get the list of all packages on your Simulator/Device, the adb command wouldn’t change. What might change is the way to run the command :
Process process = Runtime.getRuntime().exec(command);

where the command you might want to use is adb shell pm list packages

Thanks for the reply @namannigam14 !!

ProcessBuilder is the better option which is advised by forums which I refer !!!