Why not just inspect the bytes here, instead of decoding? e.g.
    if l.startswith(b'Xcode') and int(l.split()[1].split(b'.')[0]) >= 4:

I don't have a mac, so I'm not able to test this, but I'm 99% certain that it will work in both py2 & py3.