Editing plist of Finder with defaults causes Finder to relaunch constantly

Dear Apple Discussions,

I recently helped someone recover their computer with the defaults command, which showed me the power of the .plist and the defaults command.

I came across an article which explains how to change the font size of the Finder window past the default max. of 16 points.

With the Property Editor I can change the setting, relaunch the Finder and everything is fine.

But when I run this command:

defaults write com.apple.finder StandardViewOptions '{clmv={FontSize=30;};}'

and relaunch the Finder it doesn't start up properly. Instead it constantly relaunches.

Now the FontSize=30 is a little extreme but it works when I change it with Property Editor (besides I just wanted to see if it would work and what better way than going extreme - I can't really tell the difference between 16 and 17 points).

I checked the plist with Property Editor before relaunching and the value was changed to 30 via defaults.

Any ideas?

Also, it took me some time to get the encoding right for the subkey clvm - is there an Apple Developer page with some detailed examples?

Thanks,
AppleMonkey

v.1 PowerBook G4 15'' Mac OS X (10.4.3)

Posted on Nov 28, 2005 8:48 PM

Reply
8 replies

Nov 28, 2005 9:06 PM in response to Daniel Macks

Sure, but what if the editor isn't installed?

The reason I even thought of doing it via "defaults" was preciselly because th editor wasn't installed on the machine I was asked to increase the fonts on.

Starting in 10.4 you can no longer edit the plist just by dragging it into TextEdit. You first need to convert it via command line into xml.

I did finally get the syntax right (I checked it with the editor before relaunching the Finder) - it was a pain initially.

v.1 PowerBook G4 15'' Mac OS X (10.4.3)

Nov 29, 2005 8:10 AM in response to Daniel Macks

I suspect the problem was that the "Finder" requires the "FontSize" property to have a "value" with data type of "integer", whereas 'defaults write', using data enclosed by '{};' only seems to write data type "string". I am not aware of a way to get around this without converting the file to XML first, although if there is a trick, I would be interested in hearing it as well.

Nov 29, 2005 9:36 AM in response to Daniel Macks

Definetly a good catch on the key type.

Thanks for the link Daniel.

I converted the file to xml and then edited it via pico, works fine - you don't even have to convert it back to binary.

I just wish the defaults command would do what the man pages says

"If no type flag is provided, defaults will assume the value is a valid plist or plist type, and try to determine the correct value type by parsing the value. For best results, use one of the type flags, listed below."

when I try it via:

defaults write com.apple.finder -int '{StandardViewOptions={clvm={FontSize=30;};};}'

it deletes all other keys and also doesn't create an integer.

Nov 29, 2005 3:30 PM in response to Bertrand Biritz

Hi AppleMonkey,
I think that the "defaults" command does what the man page says but it's a bit cryptic and I certainly wish that it did more. The biggest problem with what you're trying to do is that the integer you're trying to add in a "dict" in a "dict" in a "dict". That is, it's too deep for the nice commands that "defaults" provides, like dict-add. You can't nest those commands.

The other problem you're having is that you're using the wrong syntax. The braces you're using in Property List Editor are themselves "incorrect" as the file is XML. If you use the fancy commands of "defaults" it will convert the results to XML but as I said, this is too deep for the fancy commands. The only way that I've been able to edit something that deep with "defaults" is to write raw XML, which works. Of course to get it right, you have to convert the property list to XML and read the other properties of "clmv" because you have to set them all at once. Here is a command that works, as long as you like all of the settings:

defaults write ~/Library/Preferences/com.apple.finder StandardViewOptions -dict-add 'clmv' '
<dict>
<key>ColumnShowFolderArrow</key>
<true/>
<key>ColumnShowIcons</key>
<true/>
<key>ColumnWidth</key>
<integer>234</integer>
<key>FontSize</key>
<integer>30</integer>
<key>ShowPreview</key>
<true/>
</dict>'

Now I have to admit that might be a just little bit of a kludge but you were determined to use the "defaults" command. 🙂
--
Gary
~~~~
Actually, typing random strings in the Finder does
the equivalent of filename completion.
-- Discussion on file completion vs. the Mac Finder

Nov 29, 2005 4:18 PM in response to Gary Kerbaugh

Yeah, I figured as much. Thanks for the info. Gary.

At least I now know the command to convert the binary into XML so that I can then edit it via the command line.

That is also another "problem" with using the defaults command - you kinda have to know what the key type is before hand. While editing it with vi you see what it is.

Thanks for all of the assistance everyone.

AppleMonkey

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Editing plist of Finder with defaults causes Finder to relaunch constantly

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.