mac下的配置文件 plist
Plist文件是以.plist为结尾的文件的总称. 系统和程序使用Plist文件来存储自己的安装/配置/属性等信息。正如可以使用命令行命令来处理大多数系统管理一样,操作Plist文件也是系统提供.
执行defaults write指令,默认修改~/Library/Preferences,/Library/Preferences
目录下的plist配置文件
作为一个例子,该命令改变dock的3D效果为基本的2D阴影:
defaults write com.apple.dock no-glass -boolean YES
相当于更改 ~/Library/Preferences/com.apple.dock.plist的no-glass键值为true。
defaults read. 读取设置
查看软件版本
defaults read /Applications/Safari.app/Contents/Info CFBundleShortVersionString
defaults write 修改键值
defaults delete 删除值
删除记录
defaults delete com.apple.Finder GoToField
OS X支持两种编码plist:文本的XML方式和二进制方式. 对于二进制方式,用户无法使用文本编辑或者如cat命令等来显示该文件, 这对于用户来说不方便,但是系统可以更快地处理二进制的Plist文件,可能基于这个原因,Leopard改变了Defaults的行 为:Defaults命令会改变Plist文件为二进制格式。
Plutil:
Plutil是开发环境提供的一个命令行命令,使用这个命令可以转换Plist文件的格式,而且可以检查Plist文件的语法和完整性.
$ plutil -convert xml1 ~/Library/Preferences/com.apple.help.plist
上面的命令将~/Library/Preferences/com.apple.help.plist文件的格式转化为文本XML格式
$ plutil -lint ~/Library/Preferences/com.apple.help.plist
上面的命令检查~/Library/Preferences/com.apple.help.plist文件, 正确返回:OK
其它工具:
Apple提供了图形工具「Property List Editor」可以查看修改plist文件,或使用gui界面的TinkerTool工具也可以修改系统设
$defaults write com.apple.finder AppleShowAllFiles -bool YES $killall Finder
恢复隐藏不可见,在终端中输入以下代码并回车
$defaults write com.apple.finder AppleShowAllFiles -bool NO $killall Finder
同样Finder需要重启
强制 Finder 显示隐藏文件和文件夹
$defaults write com.apple.Finder AppleShowAllFiles true
$defaults write com.apple.installer DebugChoiceAttrEngine -bool YES $defaults delete com.apple.installer DebugChoiceAttrEngine
$defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }' $Killall Dock
$defaults write com.apple.dashboard mcx-disabled -bool YES $killall Dock
想要重新打开,在终端输入
$defaults write com.apple.dashboard mcx-disabled -bool NO $killall Dock
$defaults write com.apple.desktopservices DSDontWriteNetworkStores true
$defaults write com.apple.screencapture location /path/
/path/ 即你想要设置的保存路径,比如将截图文件存储在用户目录的图片文件夹,命令则为:
$defaults write com.apple.screencapture location ~/Pictures/
然后输入
$killall SystemUIServer
存储类型
$defaults write com.apple.screencapture type jpg
$defaults write com.apple.helpviewer DevMode -bool true
想要还原
$defaults delete com.apple.helpviewer DevMode
$defaults write NSGlobalDomain AppleDisplayScaleFactor 1.25
这里边的数字,默认值为1,数值越大字体越大想要恢复,在终端中输入
$defaults write NSGlobalDomain AppleDisplayScaleFactor 1
在终端中输入
$defaults write /Library/Preferences/com.apple.loginwindow DesktopPicture "/Library/Desktop%20Pictures/Nature/Aurora.jpg"
引号里边是图片路径
$defaults delete /Library/Preferences/com.apple.loginwindow autoLoginUser
$defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
$defaults write com.apple.dock no-bouncing -bool TRUE $killall Dock
defaults write com.apple.dock no-glass -boolean YES killall Dock
defaults write com.apple.dock mouse-over-hilte-stack -boolean YES killall Dock
defaults write com.apple.finder DesktopViewOptions -dict IconSize -integer 256 killall Finder
defaults write com.apple.dock largesize -int 512 killall Dock
defaults write com.apple.finder QuitMenuItem -bool YES killall Finder
defaults write com.apple.Dock showhidden -bool YES killall Dock
defaults write com.apple.finder QLEnableTextSelection -bool TRUE
取消 defaults delete com.apple.finder QLEnableTextSelection
defaults write com.apple.dock itunes-notifications -bool TRUE
取消
defaults delete com.apple.dock itunes-notifications
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}';killall Dock
在DOCK最右边添加空格栏
defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}' ;killall Dock
defaults write com.apple.dock double-tap-jump-back -bool TRUE;killall Dock
取消:
defaults delete com.apple.dock double-tap-jump-back;killall Dock
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false 要想恢复默认保存到 iCloud 的话,可以将上面命令中的 false 修改为 true,再次在终端中运行
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool TRUE 注销后登录生效。 恢复提示 defaults delete com.apple.TimeMachine DoNotOfferNewDisksForBackup
defaults write com.apple.finder QLPanelAnimationDuration -int 0&&killall Finder 恢复 defaults delete com.apple.finder QLPanelAnimationDuration&&killall Finder
defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES