Create plist through command line

applicationsplist

Forgive me if there is a better way todo this, but I have an app that is generated without a plist, this is partly due to the build system that is cross platform. Is there a way to generate a plist from the command line? I looked at defaults but I can't seem to generate one. I need to be able to set one key CFBundleExecutable.

Thanks.

Best Answer

The following example creates a com.domain.programname.plist file in:

~\Library\Preferences

defaults write com.domain.programname CFBundleExecutable $value

If you want an Info.plist file this example creates one on your Desktop:

defaults write /Users/$USER/Desktop/Info CFBundleExecutable ExecutableName

You could set the path to inside the .app bundle, say it's in Applications:

defaults write /Applications/AppName.app/Contents/Info CFBundleExecutable ExecutableName

For other permutations read: man defaults

Info.plist file