modifying a Plist from command line on Mac using Defaults

前端 未结 4 1283
离开以前
离开以前 2021-01-30 17:57

Does any one know how to modify a Plist file from command line using defaults? Currently there are two Dictionaries under the URL types array; I n

4条回答
  •  -上瘾入骨i
    2021-01-30 18:39

    Open the Info.plist in a text editor to see the actual identifiers.

    defaults write Absolute/Path/to/Info.plist CFBundleURLTypes -array-add '
    CFBundleTypeRole
    Viewer
    CFBundleURLName
    Mac App Store URL
    CFBundleURLSchemes
    
    macappstore
    
    '
    

    pbpaste | pl converts the XML to the old-style format.

    defaults write Info.plist CFBundleURLTypes -array-add '{CFBundleTypeRole=Viewer; FBundleURLName="Mac App Store URL";CFBundleURLSchemes=(macappstore);}'

提交回复
热议问题