Improve mac support.
add json format command
improve osx scripts