Editing Mac OS X menus and Preference Panes

There is always that one smart mystery student in the lab who manages to bypass the Parental Controls and mess with the machine settings, or keeps shutting them down at inconvenient times just to annoy. While settings such as showing the Shut Down option in the login screen exist, removing it from the menu once the user has logged in do not. If they have managed to access the System Preferences, this option can be unchecked anyway.


Editing the Main Menu
OS X's user interface is entirely composed of .plist and .xib files, both of which are text. Although generally difficult to find, in theory it is possible to change the appearance of nearly anything. Always make a copy of the entire .nib directory in case something goes wrong, since displacing a single line could render your Finder unusable.
The interface file for the Main Menu is located in /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/
HIToolbox.framework/Versions/A/Resources/English.lproj/StandardMenus.nib/


 If you are using a different language, change the English.lproj appropriately.

The file to be edited is objects.xib. Any command-line, text-based or XML editor will work; I am using vi. Locate the section of the file containing the object to be removed; you will notice that there are two different sections for Restart and Shut Down. Remove both.

UPDATE: For 10.7 users (Lion), you will also need to remove the "Reference" line at the bottom of the file, corresponding to the ID # of the object you are removing. In the above example, the object ID is "284". The ID numbers will vary depending on the version of OS X.

You will need to log out and back in before any changes will take effect. You can in fact remove everything in the menu, including Log Out and Force Quit.



Editing the Preference Panes



A Preference Pane is the individual icon related to a particular configuration within System Preferences. What if you have a paranoid coworker who insists on disabling SSH and VNC, making your job as sysadmin much more difficult when his machine crashes? Or someone who keeps changing the Energy Saver settings, having it shut down before the company-wide backups are made at midnight?

There are two possible ways to modify a Preference Pane -- removing it altogether, or simply changing components within it. You want the coworker to be able to control his Printer Sharing, but not his Remote Access.

These particular instructions will work only with Leopard or later.

The configuration for the default Preference Panes is located in /System/Library/PreferencePanes, while those for custom applications will be in /Library/PreferencePanes. The file for the Remote Login service in particular is located in /System/Library/PreferencePanes/SharingPref.prefPane/Contents/Resources/servicelist.xml.





Locate the enclosed service to disable in the xml file and remove it. You will see that the service no longer appears in the Sharing list:






By removing the SharingPref.prefPane directory, or changing its permissions to 000, it will disappear from the System Preferences entirely.


1 comment:

Anonymous said...

Just something I found out for Lion following the above instructions for changing the default menu items in 10.7 requires that you remove the reference line of code at the bottom also. Just a heads up that it works great after that...

Post a Comment