PLIST  FILE  EDITORS,  CLEANERS,  TWEAKERS  AND  TERMINAL  COMMANDS


During your time on the computer/internet you are at some point going to come across the words TERMINAL and PLIST (Property List), usually related to tweaking and/or fixing OS X Mountain Lion settings (preferences) which are stored inside Property List (.plist) files. A PList Cleaner application for example is the equivalent of a Registry Cleaner program on Windows and the TERMINAL application is the equivalent of the Windows DOS Prompt (Command Line Interface / CLI). In terms of tweaking and cleaning the OS X Mountain Lion operating system settings (preferences) both of these applications can be used to modify (edit) the Keys and Values (i.e. ASCII, Binary, Boolean, Number, String or Array values) within each .plist file. Property List (.plist) files are similar to Windows .reg (Registry) files.


If you look inside the main Preferences folder of OS X Mountain Lion, located in the USER NAME >> LIBRARY >> PREFERENCES folder, you will see it consists of .plist files that store settings (preferences) for Third-Party Installed Software (i.e. Microsoft Office and Bitdefender Security) and the operating system itself (i.e. Dock, Desktop and Application settings). Furthermore, a .plist file is not just a text file. It can be a Text file, XML file or Binary file which means a .plist file cannot always be opened and edited with a pure Text Editor application such as TextEdit.app.



Fig 1.0  The USER NAME >> LIBRARY >> PREFERENCES folder contains the main, common, preferences (settings) for OS X Mountain Lion.

In this section I am going to show you how you can manually modify (edit) a setting within a .plist file using a commercial application called PLIST EDIT PRO and also how to edit the same setting using the TERMINAL application. Although this will be a very simple setting, the point here is that you will know how to edit (view and modify) a more important setting by the time you have read the information in this section. You might need to manually modify (edit) a setting within a .plist file if a piece of software or specific application is causing your computer problems for example or if you want to apply a Fix/Patch from a software vendor. You might just want to customize a feature of OS X (Mountain Lion), such as The DOCK; as exampled below.

Modifying (Editing) a .plist file can leave the computer's hardware, software or both in an unwanted corrupt/broken/disastrous state if the .plist file is modified (edited) in the wrong way (i.e. when a Key has one or more of its Vales set incorrectly). Continuing with this section means you understand and acknowledge this.

MODIFYING  (EDITING)  A  .PLIST  FILE


One way to manually modify (edit) a .plist file is to use the commercial PLIST File Editor called PList Edit Pro. In this first example I'm going to change the way The DOCK positions (pins) itself. Normally it positions (pins) itself in the middle (centre) of the desktop screen, either in the botton-middle, left-middle or right-middle of the desktop screen. However, if you want to change that position so that it positions (pins) itself to the left-side (start) or right-side (end) of the desktop screen such as to the bottom-left corner (bottom-start) you will need to modify (edit) the com.apple.dock.plist file and more precisely the PINNING setting (preference) within it.

Begin by launching (running/executing) the application called PLIST EDIT PRO. When its main window appears click on its BROWSER menu and select the SHOW PREFS BROWSER menu-item. Doing so will bring up the Preference File Browser windows (Fig 1.2 below) whereby you then need to scroll down the list of .plist file entries until you can see the com.apple.dock.plist file entry - Double click on that file entry to continue.



Fig 1.1  Launch PLIST EDIT PRO, click on its BROWSER menu and select the SHOW PREFS BROWSER menu-item.




Fig 1.2  Double click on the file entry called: com.apple.dock.plist

When you double click on the com.apple.dock.plist file entry the PLIST EDIT PRO application will open the actual file called com.apple.dock.plist inside its editor window (Fig 1.3 below) so you can modify (edit) the settings (preferences) within that opened .plist file. At the moment the PINNING setting (String Value) is currently set to MIDDLE but I will change it to START which means I want The DOCK positioned (pinned) in the bottom-left corner of the desktop screen and not in the bottom-middle of the desktop screen.

Changing (modifying/editing) a String Value is done by double clicking on it, or next to it, so that a RENAME edit box is placed around it (Fig 1.4). Simply rename the String Value, from MIDDLE to START in this example (Fig 1.5), and then press the ENTER keyboard key to set the PINNING String Value (setting/preference) to START.



Fig 1.3  Double click on, or next to, the String Value named MIDDLE to make it editable/renamable.




Fig 1.4  The String Value named MIDDLE can now be modified/edited (renamed)




Fig 1.5  Rename MIDDLE to START and then press the ENTER keyboard key to set the PINNING String Value to START

Once the PINNING String Value (setting/preference) has been renamed, from MIDDLE to START, and you have pressed the ENTER keyboard key the next step is to resave the com.apple.dock.plist file in order to apply the new PINNING String Value and therefore tell OS X Mountain Lion that you want The DOCK repositioned. Note: With this particular setting/preference (PINNING String Value) the change of position for The DOCK will not be noticeable until you restart the computer, or logout and log back into it. So click on the FILE menu of the PLIST EDIT PRO application and then click on its SAVE menu-item. Doing so will not bring up a SAVE AS File Requester as the com.apple.dock.plist file will be saved inside the PREFERENCES folder with its original file name of com.apple.dock.plist.



Fig 1.6  Click on the FILE menu and select the SAVE menu-item to resave the com.apple.dock.plist file inside the PREFERENCES folder

As you can see with the above example; To modify a setting/preference (i.e. String Value) within a .plist file was just a matter of launching the PLIST EDIT PRO application, navigating to the Key (specific setting) of interest (i.e. PINNING), changing its Value (i.e. MIDDLE) and then resaving the .plist file. If you are familiar with the Windows Registry you will know about Keys and Values - Keys are basically the settings and Values are basically the values which are divided into Class - Examples: YES/NO (Boolean), OFF/ON (Boolean), 0/1 (Binary or Number), TRUE/FALSE (Boolean), Middle (String) and 285 (Number).

USE  THE  TERMINAL  APPLICATION

The above is all well and good, but is a bit technical for the non-programmer for example. And if you only need a couple of settings changed, every now and then, there are cheaper options than buying an application such as PLIST EDIT PRO. You could use the TERMINAL application, for example, that is built-in to the OS X Mountain Lion operating system. To change the position of The DOCK as exampled above, but using the TERMINAL application instead, you would launch the TERMINAL application from within the UTILITIES folder (APPLICATIONS >> UTILITIES >> Terminal) and then type (or PASTE) the following command into its windows - defaults write com.apple.dock pinning -string "start" (Fig 1.8 below) before pressing the ENTER keyboard key to apply the command.



Fig 1.7  Launch the FREE, built-in to OS X Mountain Lion, TERMINAL application to modify (edit) .plist file settings (preferences).

When you double click in the Terminal.app application icon within the UTILITIES folder the small Terminal window will appear stating your last login and your computer's name. After that there is a Flashing Cursor. This denotes it is waiting for you to type (or PASTE) something into its window. In this case the command - defaults write com.apple.dock pinning -string "start" - which tells OS X Mountain Lion to change the position of The DOCK, as described/exampled above.



Fig 1.8  Type - defaults write com.apple.dock pinning -string "start" - into the Terminal window and then press the ENTER keyboard key

The DEFAULTS command is similar to a Windows DOS command (i.e. DIR, OPEN, etc) - Following DEAULTS is the instruction WRITE. It means the DEFAULTS command should write (save), as opposed to read (open), any modified settings within the file name that follows it - com.apple.dock in this case. Notice the absence of .plist. This is because the DEFAULTS command knows it is dealing with a .plist file. Its function is to set default values within a .plist file. Anyway! Following that is the Key (setting) that you want to modify (PINNING) followed by the Class (STRING) of its Value (START).


Ignore the technicals if you wish!! All you need to remember here is that wherever you see a DEFAULTS Terminal Command (i.e. from a website or computer magazine) you must COPY & PASTE, or type in, that command exactly as you see it. You must follow the exact same CASE for example (i.e. UPPERCASE, lowercase or Sentencecase) and you must include any quotation marks ("") and other punctuation marks you see. In other words, even if you are not familiar with what the command does (i.e. you have been told "Just paste that into the Terminal window and all your problems will be fixed") you still need to make sure it is written in the Terminal window exactly as you see it on a website or in a computer magazine (if they themselves have no errors in them of course!).

If you have done everything correctly; After pasting or typing in the command and pressing the ENTER keyboard key you should see your computer's name with a flashing cursor next to it again, as opposed to an error message. This particular DEFAULTS command does not take effect until you log-off or restart the computer.



Fig 1.9  The terminal command was successfully applied - No error message has been displayed.

Another option to modify settings within a .plist file is to use a Programmer's Text Editor (known as an: IDE). Something like Text Wrangler, BBEdit or PrefEdit, but NOT the built-in Apple Mac application called TextEdit or the FREE Code Editor called Komodo Edit.

USE  A  PROGRAMMER'S  TEXT  EDITOR

Why shouldn't you use TextEdit or Kommodo? Answer. Because PList files are XML files with binary and non-ASCII aspects to them which means TextEdit and Komodo Edit are not really ideal for viewing and editing .plist files as they tend to misinterpret the non-ASCII characters and binary aspects of the .plist file display-wise (i.e. they show gibberish text/code) and therefore make .plist files uneditable. In those circumstances you would never try and edit a .plist file because saving it would lead to natural (man-made) file corruption. In other words, the .plist file would be saved as corrupted data and therefore might break the operating system.



Fig 1.10  A PList file is a XML Binary file that can be viewed and edited with the Text Wrangler or BBEdit programmer's text editor



Fig 1.11  Not all text editor applications display/interpret the Binary Code within a .plist file properly, therefore making it uneditable.

Now you know what a .plist file is (a preference file basically) and how it can be modified (edited) for certain purposes the last things to know about are the Mac Cleaner and Mac Tweaker applications; and more importantly what they do.

MAC  CLEANER  AND  MAC  TWEAKER  APPLICATIONS

Mac Cleaners

A Mac Cleaner application looks through your computer system for redundant/leftover files which normally include log (report/error) files, .plist (preference) files that belong to an uninstalled application, language files that have not been used for a year or so and duplicated files. To determine what files to delete a good Mac Cleaner application should check if a file is still active (in use or recently used) and whether or not it is needed by the operating system and/or a third-party piece of software. It should also check if a file has a duplicate and if so, is it just a redundant duplicate file or is it a needed duplicate file. In other words, it should not delete a file just because there is a newer version of it or because it has not been used for a while. The Mac Cleaner application has to be more thorough and smarter than that in the way it carries out its checks.

The problem with any Mac Cleaner application is when it starts deleting files it doesn't understand or treats as alien and/or virus infected, when in fact there is nothing wrong with the file. This can happen with Mac Cleaner applications that try and be too clever by claiming they can "clean everything". For example. A bad Mac Cleaner application might not of been updated with information on a new file format (structure) or the way a new piece of software creates its preference files, therefore it might think those new preference files are corrupted, alien, and/or virus infected. A good Mac Cleaner application on the other hand is one that has an update feature - The programmer keeps the application's database informed of new software and new file formats for example.

As an example of things going wrong with a Mac Cleaner application you only have to read this MacRumors Forum post about the application called CleanMyMac to get an idea of what I am talking about. And if you search the internet for "Is CleanMyMac Safe?" for example you will get an even greater idea. Basically, there are many people who feel OS X (Mountain Lion) does not need to be cleaned-up by a Mac Cleaner application. The same applies to Application Cleaner and Application Uninstaller applications such as AppCleaner and AppZapper. It is questionable how much hard drive space these cleaner/uninstaller applications really save you. For example, the application called Monolingual removes unwanted Language files, but does it really save you thousands of gigabytes that make a real difference to the overall performance of your computer? The answer is NO.

Mac Tweakers

A Mac Tweaker application, such as TinkerTool, is basically an application that modifies (edits) entries within .plist files, as well as other preference file types. They usually allow you to customize certain operating system settings and third-party hardware/software settings. A Mac Tweaker application might make claims that it has improved your broadband speed, os x start-up time or whatever. Just as you have good and bad Mac Cleaner applications you also have good and bad Mac Tweaker applications. On the bad side they can tweak the wrong preferences and end up crippling the operating system and/or a piece of hardware/software. On the good side they can improve things, but only by a small percent in general.

CONCLUSIONS

The reason I have brought the Mac Cleaner and Mac Tweaker applications to your attention is because if/when they screw up your computer files and/or applications you may need to manually edit one or more of their .plist files in order to restore their functionality and makes things better. And the same goes for those occasions when a cleaner or tweaker application has changed one or more of your operating system and/or application settings (i.e. switched something off that you wanted kept on).

PLIST  FILES  AND  ATTRIBUTES


For those who prefer to use a PList File Editor, below I have given a quick rundown of what the main attributes are within a plist file. As said above; PList files are the backbone of the Preferences structure. They store the actual settings (KEYS, CLASSes and VALUES) for a piece of hardware, piece of software or both (if they are related). A KEY is just the name of the setting (preference) at the end of the day. It has a VALUE associated/attached to it (the actual number or text) that is of a certain CLASS (DataType - see below).

To a certain degree you don't normally concern yourself with the actual .plist files, in terms of their file name and what they are used for, because in normal circumstances you will only be modifying (editing) one or more VALUES within a .plist file.

In Fig 1.2 above, for example, double clicking on com.apple.dock.plist displayed some of the main KEYS (preferences) associated with The DOCK (Fig 1.3) which were made up of the Datatypes (Classes) called DICTIONARY, NUMBER, STRING, ARRAY and BOOLEAN. Just as you have FileTypes (Video files, Music files, Executable files and so on) for a file you also have DataTypes (Number or Text), also known as CLASSes on the apple mac, for the actual VALUES within a .plist file structure. For example. The type of data (DataType/CLASS) used for a number preference (KEY) might be DWORD or BOOLEAN for example whereas the type of data (DataType/CLASS) used for a string of text preference will normally be STRING. These are the two commonly used datatypes, DWORD and STRING, but there are others.

DWORD

A Number which is made up of four bytes (i.e 254,12,147,213) that when multiplied/combined result in a 32 bit number. Never mind the technicals of 32 Bit number, to you and me it stores a number that hopefully means something. For example. If a .plist file has a KEY (preference) called MaxImageWidth with a VALUE of 128, this might refer to the maximum width that all images must use or the maximum width of their thumbnail (preview icon). You wouldn't necessarily know until you read up about that particular preference. A typical use for a DWORD is to store the width, height or number of something (i.e the number of colours or users, the width or height of a window and so on).

STRING

The STRING DataType (CLASS) refers to a string of text or characters. In Fig 1.3 above I changed the VALUE of a KEY called PINNING, from 'middle' to 'start'. So 'middle' was a string of text, as was 'start'. Both were CLASSed as a STRING. Or put another way; The KEY (preference) called PINNING uses a CLASS (DataType) called STRING that has a VALUE called 'middle' (or 'start'). By changing the VALUE I was able to alter the position of The DOCK.

ARRAY

An array is normally made up of multiple pairs/sets of KEYS and VALUES. For example, it could contain KEY ImageWidth CLASS Number VALUE 500, KEY ImageHeight CLASS Number VALUE 200, KEY ImageColours CLASS Number VALUE 6. On the apple mac an array can also contain a set of DICTIONARIES. So if an array was a shopping list (i.e. Fruit and Meat) the dictionaries would normally be the sub-arrays (i.e. Apple, Banana and Pear followed by Beef, Lamb and Pork). Or put another way; KEY Shopping List CLASS Array, whereby its VALUES are then dictionaries (sub-arrays) that contain pairs/sets of KEYS and VALUES such as KEY Fruit CLASS String VALUE Apple; with the next array element (sub-array) being KEY Fruit CLASS String VALUE Banana for example. In other words; If the array is Fruit, its Dictionaries could be Apple, Banana and so on.

BOOLEAN

BOOLEAN is a CLASS that represents a True/False, Yes/No or 0/1 VALUE. It is normally used to switch something on or off.

NUMBER

NUMBER is a CLASS that normally represents a software version number (i.e. KEY Version CLASS Number VALUE 1.6.4), a negative number (i.e. -12), a positive number (i.e. 27) or minute number (i.e. 167.4000000000000000 or 12983.233.91283).

PUTTING  THINGS  INTO  PERSPECTIVE

Hopefully, you can see the complexities of messing around with .plist files and what they can do if modified the wrong way. On the other hand I have given you this section (lesson page) so that you also realize that you do not have to be a programmer if you only need to edit the occasional preference; as seen in a computer magazine or online for example. In other words, don't be afraid of the .plist file. ALWAYS MAKE A BACKUP COPY OF ANY .PLIST FILE YOU ARE GOING TO WORK ON, but do not be afraid to change the preferences (settings) within it. And remember, there may be any easier TERMINAL Command available for the preference you want to modify (edit). Always search the internet for that alternative option first.