Skip to content

Instantly share code, notes, and snippets.

@MagerValp MagerValp/32bitapps.py forked from erikng/32bitapps.py
Last active Jan 26, 2018

Embed
What would you like to do?
32bitapps.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
import io
import sys
import codecs
if sys.stdout.encoding != "UTF-8":
sys.stdout = codecs.getwriter("utf-8")(sys.stdout, "strict")
if sys.stderr.encoding != "UTF-8":
sys.stderr = codecs.getwriter("utf-8")(sys.stderr, "strict")
import subprocess
import plistlib
def main(argv):
cmd = ["/usr/sbin/system_profiler", "-xml", "SPApplicationsDataType"]
proc = subprocess.Popen(cmd,
shell=False,
bufsize=-1,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
output, err = proc.communicate()
plist = plistlib.readPlistFromString(output)
items = plist[0]["_items"]
print("Path\tName\tVersion")
for item in sorted(items, key=lambda x: x.get("path")):
if "no" in item.get("has64BitIntelCode"):
print("\t".join([item.get("path"), item.get("_name"), item.get("version")]))
if __name__ == '__main__':
sys.exit(main(sys.argv))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.