Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Iterm2 settings with OSX defaults command

Tags:

macos

iterm2

I am trying to do the following

disable Iterm2 settings like "Draw bold text in bold font" from COMMAND line, I know it is easy to disable with few mouse clicks, because I am using Boxen to setup my Mac, just want to be able to get some application settings sorted as well.

I run following command to verify the settings first

defaults read com.googlecode.iterm2 | grep -i bold

it returns

"Bold Color" =             {
        "Use Bold Font" = 1;
        "Use Bright Bold" = 1;

That looks good and when I try to modify it, following command did not work, it created another key.

defaults write com.googlecode.iterm2 '{ "Use Bold Font" = 0;}'

defaults read com.googlecode.iterm2 | grep -i bold
        "Bold Color" =             {
        "Use Bold Font" = 1;
        "Use Bright Bold" = 1;
"Use Bold Font" = 0;

so looks like "Use Bold Font" is a subkey or one level deep, I am not sure how to modify it.

any suggestions?

like image 337
Ask and Learn Avatar asked Oct 15 '13 01:10

Ask and Learn


1 Answers

Did some research and found answer myself, post it here just to share with others

"Use Bold Font" is part of a dictionary, and we need to use plistbuddy to change it, here is the command to see the current settings

[admin@mb-125:~] : /usr/libexec/PlistBuddy -c 'Print :"New Bookmarks":0:"Use Bold Font"' ~/Library/Preferences/com.googlecode.iterm2.plist
true

And this is how you change it from command line

[admin@mb-125:~] : /usr/libexec/PlistBuddy -c 'Set :"New Bookmarks":0:"Use Bold Font" false' ~/Library/Preferences/com.googlecode.iterm2.plist

Check again

[admin@mb-125:~] : /usr/libexec/PlistBuddy -c 'Print :"New Bookmarks":0:"Use Bold Font"' ~/Library/Preferences/com.googlecode.iterm2.plist
false

So basically you should be able to change all the settings from command line.

like image 115
Ask and Learn Avatar answered Oct 21 '22 23:10

Ask and Learn