4

Helloo, I'm using OS X El Capitan 10.11.3

I'm trying to change Sidebar on Finder. I have got difference results with defaults read and defaults export.

Example:

1. defaults read command

defaults read com.apple.sidebarlists > ~/Desktop/com.apple.sidebarlists.plist

Result:

{
    systemitems =     {
        Controller = VolumesList;
        CustomListProperties =         {
            "com.apple.LSSharedFileList.VolumesListMigrated" = 1;
        };
        ShowEjectables = 1;
        ShowHardDisks = 1;
        ShowRemovable = 1;
        ShowServers = 1;
        VolumesList =         (
                        {
                EntryType = 16;
                Name = Computer;
                SpecialID = 1919905652;
                Visibility = AlwaysVisible;
            },
                        {
                Alias = <00000000 00640003 00010000 d30c9f76 0000482b 00000000 00000001 00000002 0000d30c 9f760000 00000920 fffe0000 00000000 0000ffff ffff0001 0000000e 00080003 004f0053 0058000f 00080003 004f0053 00580012 00000013 00012f00 ffff0000>;
                CustomItemProperties =                 {
                    "com.apple.LSSharedFileList.SeenAsBootVolume" = 1;
                    "com.apple.LSSharedFileList.TemplateSystemSelector" = 1935821166;
                };
                EntryType = 261;
                Name = OSX;
            },
                        {
                Alias = <00000000 00780003 00010000 d30c9f94 0000482b 00000000 00000001 00000002 0000d30c 9f940000 00000900 fffe0000 00000000 0000ffff ffff0001 0000000e 000c0005 00530074 00750066 0066000f 000c0005 00530074 00750066 00660012 00000013 000e2f56 6f6c756d 65732f53 74756666 ffff0000>;
                CustomItemProperties =                 {
                    "com.apple.LSSharedFileList.TemplateSystemSelector" = 1935821166;
                };
                EntryType = 261;
                Name = Stuff;
            },
                        {
                Alias = <00000000 00880003 00010000 d30caaf0 0000482b 00000005 00000001 00000002 0000d30c aaf00000 00000902 fffe0000 00000000 0000ffff ffff0001 0000000e 00120008 0075006e 00740069 0074006c 00650064 000f0012 00080075 006e0074 00690074 006c0065 00640012 00000013 00122f70 72697661 74652f76 61722f73 65747570 ffff0000>;
                CustomItemProperties =                 {
                    "com.apple.LSSharedFileList.TemplateSystemSelector" = 1935820100;
                };
                EntryType = 515;
                Name = untitled;
            },
                        {
                Alias = <00000000 00d20003 00010000 d30c7e7e 0000482b 00000005 00000001 00000002 0000d30c 7e7e0000 00000902 fffe0000 00000000 0000ffff ffff0001 0000000e 00300017 0049006e 00730074 0061006c 006c0020 004f0053 00200058 00200045 006c0020 00430061 00700069 00740061 006e000f 00300017 0049006e 00730074 0061006c 006c0020 004f0053 00200058 00200045 006c0020 00430061 00700069 00740061 006e0012 00000013 00202f56 6f6c756d 65732f49 6e737461 6c6c204f 53205820 456c2043 61706974 616effff 0000>;
                CustomItemProperties =                 {
                    "com.apple.LSSharedFileList.TemplateSystemSelector" = 1935820100;
                };
                EntryType = 515;
                Name = "Install OS X El Capitan";
            },
                        {
                Alias = <00000000 00740003 00010000 d30c9f76 0000482b 00000000 00000002 0001bede 0000d21e 8bc10000 00000920 fffe0000 00000000 0000ffff ffff0001 0000000e 00100007 004e0065 00740077 006f0072 006b000f 00080003 004f0053 00580012 00074e65 74776f72 6b000013 00012f00 ffff0000>;
                EntryType = 16;
                Name = Network;
                SpecialID = 1735288180;
                Visibility = NeverVisible;
            },
                        {
                Bookmark = <626f6f6b d4030000 00000410 30000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 f4020000 07000000 01010000 566f6c75 6d657300 0a000000 01010000 4b696b6f 27732048 44440000 08000000 01060000 04000000 14000000 08000000 04030000 1f2c0600 00000000 08000000 04030000 02000000 00000000 08000000 01060000 38000000 48000000 08000000 00040000 41bc2673 4f0a8ece 18000000 01020000 0a000000 00000000 0f000000 00000000 00000000 00000000 00000000 01050000 1d000000 01090000 66696c65 3a2f2f2f 566f6c75 6d65732f 4b696b6f 27732532 30484444 2f000000 08000000 04030000 00f89f92 ae000000 18000000 01020000 09010000 01000000 ef130000 01000000 00000000 00000000 13000000 01010000 2f566f6c 756d6573 2f4b696b 6f277320 48444400 08000000 01090000 66696c65 3a2f2f2f 03000000 01010000 4f535800 08000000 04030000 00007a4a 2f000000 08000000 00040000 41bc9726 76000000 24000000 01010000 30354541 45393435 2d443641 382d3334 45432d38 3343372d 42453046 42364134 46464137 18000000 01020000 81000000 01000000 ef130000 01000000 00000000 00000000 01000000 01010000 2f000000 60000000 feffffff 00f00000 00000000 07000000 02200000 9c010000 00000000 05200000 14010000 00000000 10200000 24010000 00000000 11200000 50010000 00000000 12200000 30010000 00000000 13200000 40010000 00000000 20200000 7c010000 00000000 04000000 03030000 00f00000 04000000 03030000 00000000 04000000 03030000 01000000 0c000000 01060000 10020000 1c020000 28020000 a4000000 01020000 66356561 34636463 31346437 39656535 62623065 63323232 64333234 61376535 36343738 64376662 3b303030 30303030 303b3030 30303030 30303b30 30303030 30303030 30303030 3032303b 636f6d2e 6170706c 652e6170 702d7361 6e64626f 782e7265 61642d77 72697465 3b303030 30303030 313b3031 30303030 30373b30 30303030 30303030 30303030 3030323b 2f766f6c 756d6573 2f6b696b 6f277320 68646400 a8000000 feffffff 01000000 a8010000 0d000000 04100000 28000000 00000000 05100000 58000000 00000000 10100000 78000000 00000000 40100000 68000000 00000000 00200000 34020000 00000000 02200000 f8000000 00000000 05200000 a0000000 00000000 10200000 14000000 00000000 12200000 c8000000 00000000 13200000 68000000 00000000 20200000 d8000000 00000000 01d00000 98000000 00000000 80f00000 48020000 00000000>;
                CustomItemProperties =                 {
                    "com.apple.LSSharedFileList.TemplateSystemSelector" = 1935820100;
                };
                EntryType = 1029;
                Name = "Kiko's HDD";
            },
                        {
                Bookmark = <626f6f6b f8030000 00000410 30000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0c030000 07000000 01010000 566f6c75 6d657300 07000000 01010000 4e4f204e 414d4500 08000000 01060000 04000000 14000000 08000000 04030000 1f2c0600 00000000 00000000 010a0000 08000000 01060000 34000000 44000000 08000000 00040000 c1c3c060 08000000 18000000 01020000 0a000000 00000000 0f000000 00000000 00000000 00000000 00000000 01050000 1a000000 01090000 66696c65 3a2f2f2f 566f6c75 6d65732f 4e4f2532 304e414d 452f0000 08000000 04030000 0000a015 00000000 24000000 01010000 43334637 41444536 2d424546 332d3332 34382d39 4335462d 39383134 43303243 35303438 18000000 01020000 01010000 00000000 ef130000 01000000 00000000 00000000 10000000 01010000 2f566f6c 756d6573 2f4e4f20 4e414d45 08000000 01090000 66696c65 3a2f2f2f 03000000 01010000 4f535800 08000000 04030000 00007a4a 2f000000 08000000 00040000 41bc9726 76000000 24000000 01010000 30354541 45393435 2d443641 382d3334 45432d38 3343372d 42453046 42364134 46464137 18000000 01020000 81000000 01000000 ef130000 01000000 00000000 00000000 01000000 01010000 2f000000 60000000 feffffff 00f00000 00000000 07000000 02200000 b4010000 00000000 05200000 2c010000 00000000 10200000 3c010000 00000000 11200000 68010000 00000000 12200000 48010000 00000000 13200000 58010000 00000000 20200000 94010000 00000000 04000000 03030000 00f00000 04000000 03030000 00000000 04000000 03030000 01000000 0c000000 01060000 28020000 34020000 40020000 a1000000 01020000 39653531 62373061 63366231 31333336 32393936 38323738 39306434 63363063 33316535 63393332 3b303030 30303030 303b3030 30303030 30303b30 30303030 30303030 30303030 3032303b 636f6d2e 6170706c 652e6170 702d7361 6e64626f 782e7265 61642d77 72697465 3b303030 30303030 313b3031 30303030 30383b30 30303030 30303030 30303030 3030323b 2f766f6c 756d6573 2f6e6f20 6e616d65 00000000 b4000000 feffffff 01000000 c0010000 0e000000 04100000 24000000 00000000 05100000 4c000000 00000000 10100000 6c000000 00000000 40100000 5c000000 00000000 00200000 4c020000 00000000 02200000 14010000 00000000 05200000 94000000 00000000 10200000 14000000 00000000 11200000 c8000000 00000000 12200000 b8000000 00000000 13200000 5c000000 00000000 20200000 f4000000 00000000 01d00000 8c000000 00000000 80f00000 60020000 00000000>;
                CustomItemProperties =                 {
                    "com.apple.LSSharedFileList.TemplateSystemSelector" = 1935820100;
                };
                EntryType = 517;
                Name = "NO NAME";
            }
        );
    };
}

2. defaults export command

defaults export com.apple.sidebarlists > ~/Desktop/com.apple.sidebarlists.plist

Result:

2016-03-15 11:49:28.395 defaults[17702:268352] 
Need a path to write to

and I have got zero KB file

My question:

  1. What is difference defaults read and defaults export?
  2. What is the best choice to edit my sidebar?
  • What's wrong with defaults export com.apple.sidebarlists ~/Desktop/com.apple.sidebarlists.plist (after removing the zero sized file) except that it is the binary form of the file created by defaults read com.apple.sidebarlists > ~/Desktop/com.apple.sidebarlists.plist? – klanomath Mar 15 '16 at 5:29
  • could I export com.apple.sidebarlists.plist with defaults export command? why did I get zero KB file with defaults export command? – kiki.kiko Mar 15 '16 at 7:32
6

The output from defaults read is sent to standard output in human readable format.

The output from defaults export is put in the file that you specify in the command in binary format.

The problem with your defaults export example:

  • you redirected the standard output to the file: ~/Desktop/com.apple.sidebarlists.plist (using >) and defaults export doesn't send anything to standard output; the result was a file that had nothing in it.
  • defaults export requires that you specify an output file in the command. Including the redirection operator (>) before the filename redirected standard output to that file and effectively removed the filename from the command (since redirection of input or output effectively happens prior to command parsing) Thus no output file was specified which resulted in the error message saying that you need "a path to write to".

Depending on what changes you are making:

  • if possible, use the Finder's Preferences… to change things.
  • if Preferences… can't accomplish what you need then it's probably easiest to use defaults read to produce output in a form that you can easily edit and then use defaults write 'plist' (see man documentation) to "install" your changes.
  • there are other ways to do what you want of varying degrees of difficulty.

I'll just mention that the documentation for the defaults command states:

Defaults can be structured in very complex ways, making it difficult for the user to enter them with this command.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .