Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.5: Remove Shut Down from the Apple menu System 10.5
Leopard only hintWe have some users who, through habit or sloppy clicking, always shutdown their machine when they leave. This means that we can't perform maintenance without walking to the machine. If you need to prevent users from shutting down machines so you can do maintenance, this will help by removing the Shut Down item from the Apple Menu.

The following patch removes the Shut Down menu item for everyone on the system, admin and non-admin users alike. The patch doesn't delete the entire object, it just replaces the content of the object with a separator. Deleting the entire object causes Bad Things To Happen. You can probably use this method to remove other items in the Apple Menu, but I haven't tested that.

Warning: Altering anything under /System/Library is always risky. Don't deploy this without testing it thoroughly in your environment. I don't know for sure what will happen when updates are applied to the box, though I haven't seen any problems.

You will need to be an admin user or root to apply this patch:
----- Start here -----
--- objects.xib.orig    2009-11-02 12:36:04.000000000 -0500
+++ objects.xib 2009-11-02 13:48:07.000000000 -0500
@@ -180,10 +180,7 @@
     </object>
     <reference idRef="283"/>
     <object class="IBCarbonMenuItem" id="238">
-      <string name="title">Shut Downâ¦</string>
-      <boolean name="dynamic">TRUE</boolean>
-      <boolean name="notPreviousAlternate">TRUE</boolean>
-      <ostype name="command">rsdn</ostype>
+      <boolean name="separator">TRUE</boolean>
     </object>
     <object class="IBCarbonMenuItem" id="241">
       <string name="title">Recent Items</string>
@@ -343,10 +340,7 @@
         <reference idRef="284"/>
         <reference idRef="238"/>
         <object class="IBCarbonMenuItem" id="285">
-          <string name="title">Shut Down</string>
-          <boolean name="dynamic">TRUE</boolean>
-          <int name="keyEquivalentModifier">1572864</int>
-          <ostype name="command">shut</ostype>
+          <boolean name="separator">TRUE</boolean>
         </object>
         <reference idRef="239"/>
         <reference idRef="240"/>
------- End here ------
Save it as menu.diff, and apply it as follows. First, change to the directory where the Standard Menu xib file lives:
cd /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/English.lproj/StandardMenus.nib
Then apply the patch:

patch --fuzz=0 -B ~/ -b objects.xib /path/to/the/saved/menu.diff

This will only apply the patch if it matches exactly (--fuzz=0) and will save a copy of the objects.xib file into your home directory (-B ~/ -b). If there are any problems, you can copy the file back to the correct location. Log out then log back in and the menu item should be gone.

[robg adds: I haven't tested this one, and if you're going to do so, please be careful - modifying system files can lead to bad things, as the warning notes!]
    •    
  • Currently 2.41 / 5
  You rated: 5 / 5 (32 votes cast)
 
[13,482 views]  

10.5: Remove Shut Down from the Apple menu | 23 comments | Create New Account
Click here to return to the '10.5: Remove Shut Down from the Apple menu' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Remove Shut Down from the Apple menu
Authored by: V.K. on Nov 16, '09 07:49:19AM

I would suggest using Workgroup Manager (part of Server Admin tools, a free download even if you don't have SL server) for this rather than hacking the system. Workgroup manager allows you to remove the shutdown menu from the apple menu for managed users. This can be done on per group basis so that you don't have to do it one user at a time.
Much safer than mucking around with system files.



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: donpardo on Nov 17, '09 07:35:15AM

Will Workgroup Manager work for users using centralized ldap and kerberos logins and mounting home directories via NFS?



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: donpardo on Nov 17, '09 07:39:56AM

And does it have a command line interface?



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: gabester on Nov 16, '09 07:53:50AM

I would think a more effective and standard way to do this would be to use Energy Saver settings to automatically turn the computer during your maintenance window and/or enable the "Start up automatically after a power failure" and "Wake for network access."

I also think there are some MCX settings that would remove the Shut down option from the menu (I know it can be removed from the login window), although I haven't personally looked at OS X Server in a while.

Best bet would be mapping the shut down command to sleep; then you can use WOL to bring the Macs up for your maintenance.

Finally, by making the item into a separator does it act as a separator or does selecting the separator shut down the computer? Hopefully this won't generate more support calls for you!
g=



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: UberFu on Nov 16, '09 09:55:03AM
I would think a more effective and standard way to do this would be to use Energy Saver settings to automatically turn the computer during your maintenance window and/or enable the "Start up automatically after a power failure" and "Wake for network access."
The problem with this is that it won't prevent someone from shutting down the computer and someone else from having to manually reboot the machine. The only bypass to this is the Schedule Option and this only works at a given moment during the day based on what it's set to. So it does no good if someone shuts the machine down 5 minutes after the scheduled start or wake up time. As VK mentioned on the first response to this Thread - The Admin Tools are the best and safest method to accomplish this.

[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: ozcaveboy on Nov 16, '09 02:39:27PM

Using the pmset command does not require someone to manually reboot the machine. An example of a one-time start up would be:

sudo pmset schedule wakeorpoweron "mm/dd/yy hh:mm:ss"

This command will cause the computer to start up or wake up at the specified time. There are also options for repeating schedules. While it's true that the user could shut down the computer moments after it has been booted up, you can always schedule maintenance to occur after everyone's left for the day. I use ARD to schedule updates and maintenance to occur at 3 am. You can also use ARD to lock the screen so that no one can come along and shut it down.

Edited on Nov 16, '09 02:44:06PM by ozcaveboy



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: gabester on Nov 16, '09 07:53:50AM

I would think a more effective and standard way to do this would be to use Energy Saver settings to automatically turn the computer during your maintenance window and/or enable the "Start up automatically after a power failure" and "Wake for network access."

I also think there are some MCX settings that would remove the Shut down option from the menu (I know it can be removed from the login window), although I haven't personally looked at OS X Server in a while.

Best bet would be mapping the shut down command to sleep; then you can use WOL to bring the Macs up for your maintenance.

Finally, by making the item into a separator does it act as a separator or does selecting the separator shut down the computer? Hopefully this won't generate more support calls for you!
g=



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: donpardo on Nov 16, '09 08:06:01AM

We're primarily a Linux shop and we choose not to use OSX Server for our workstation management. We've found that we can accomplish almost everything we need to do (including automated installs) with shell scripts.

You can't select the separator, so that's not a risk.

I will update this if I see any problems with OS updates or once I've been through a couple of OS updates.



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: fizzboy on Nov 16, '09 01:54:06PM

You don't need an OS X server to use MCX policy on your Macs.

http://managingosx.wordpress.com/2008/02/07/mcx-dslocal-and-leopard/

Feel free to Google around for more info.

Using local MCX policy, you can use Workgroup Manager to manage nearly any setting, including access to the shut down menu items. If, for some reason, you just really don't want to use local MCX, you can write the values directly into the appropriate preference files:

sudo defaults write /Library/Preferences/com.apple.loginwindow ShutDownDisabled -bool true
sudo defaults write /Library/Preferences/com.apple.loginwindow ShutDownDisabledWhileLoggedIn -bool true

Log out and log back in to see your changes.



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: donpardo on Nov 17, '09 07:33:32AM

Don't those preferences control the login window rather than the Apple menu?



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: donpardo on Nov 17, '09 07:52:28AM

I've tested these commands. They neither remove nor disable the shutdown command from the Apple Menu.



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: Auricchio on Nov 16, '09 10:43:48AM

Don't ever tell the users that pressing the Power key presents a dialog allowing them to shut down.

This problem can be solved by a management reprimand. They'll get the hint. We don't need to try to solve behavior problems with technology.

---
EMOJO: mojo no longer workin'



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: rhowell on Nov 16, '09 12:42:51PM

Or, you could always have a dummy admin account logged in. Then any attempt to shut down would require authentication.



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: Auricchio on Nov 16, '09 12:46:10PM

This is actually a neat solution. The users who accidentally try to shut down (or forget they shouldn't) would then be able to say "oops" and cancel the attempt.

How is the OP handling sleeping systems? A closed laptop won't wake. I also think you still can't wake any sleeping system that's connected via Airport.

---
EMOJO: mojo no longer workin'



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: beepotato on Nov 16, '09 03:06:59PM

"I also think you still can't wake any sleeping system that's connected via Airport."

Actually you can on the most recent Macs.



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: baltwo on Nov 16, '09 01:49:46PM

Doesn't prevent the other shutdown options, such as CONTROL+OPTION+COMMAND+EJECT, CONTROL+EJECT, etc.



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: donpardo on Nov 17, '09 07:32:07AM

I'm not trying to. A small set of my users are unintentionally shutting down boxes through sloppy clicking.

I can't stop a user from shutting down the machine. They can unplug it if they are intent on powering it off.



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: baltwo on Nov 17, '09 04:42:01PM

Then, teach them the keyboard shortcut for logging out (CMD+SHIFT+Q) or defer the maintenance. I can't imagine the machines need daily maintenance. If you imply running the maintenance scripts, it's easier to do it on initial boot via a login script. Just my 2˘.



[ Reply to This | # ]
Please...
Authored by: leamanc on Nov 16, '09 06:57:59PM

...don't do what is described in this hint. It is just asking for trouble, and will likely be over-written with a software update. Or worse, a software update will fail or hose your machine because key system components that are not intended to be modified have been modified.

I have done stuff like this before, and weird things happen like the Dock stops working properly (it shows, but clicking on icons has no effect), kernel panics, etc.

As noted above in many hints, Managed Users can have *whatever* you like taken away from them, even if you don't use OS X Server. Just grab a copy of Workgroup Manager, log into the server "localhost" with admin credentials, and create a group for the users you'd like to manage, and set policies for that group of managed users. Google around for more info. Apple doesn't make this info readily apparent--they'd probably rather you buy OS X Server and set up an OpenDirectory domain--but it's there, much safer and supported.



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: Dolf on Nov 18, '09 03:16:37AM

Isn't this an environmental-unfriendly hint? To have all your systems allways active for the occaisional maintenance?



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: dashard on Nov 18, '09 07:21:56AM

In a corporate environment it's just a fact of life -- the machines need to be up for backups, admin access, etc. And, while idle, they consume very few resources.



[ Reply to This | # ]
10.5: Remove Shut Down from the Apple menu
Authored by: tedw on Nov 18, '09 09:29:55AM
Really, this is just a bit silly. Corporate groupthink: use the most dramatic solution possible within the bounds of feasible solutions... ;-)

Here's a rough take on an easier way to do this. Take the following code, copy it into Script Editor, and save it as a stay-open application (which I'll call "NoNoNo.app", but you can name whatever you like):

on quit
	tell application "Finder"
		activate
		display alert "Shut Down Warning" message "Please do not shut down this machine.  Administrators need access for routine maintenance." as critical
	end tell
end quit
Now, run the NoNoNo application (in fact, make it a login item). Every time someone tries to shut down or log out of the machine, they will get a warning alert as above, and then a minute later the Finder will tell them that it's canceling the logout because the application "NoNoNo" would not quit. The only way to restart or log out is to force-quit NoNoNo.app, which most users won't do, and which you could probably prevent by changing it's permissions level.

The concept could use some refinement, but at least it doesn't require hacking core elements of the system.

[ Reply to This | # ]

10.5: Remove Shut Down from the Apple menu
Authored by: bud25 on Jun 13, '12 08:25:58PM

• First off you will have to locate the StandardMenus.nib in /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/English.lproj/StandardMenus.nib then right click and show package contents

• Make a copy of the objects.xib file before you modify!!!!! it's not my problem if you don't do this but it may make your changes irreversible if you don't

• Then open objects.xib with any text editor and search for shut down and replace the 'rsdn' in <ostype name="command">rsdn</ostype> with ether 'logo' to log off someone trying to shut down or 'slep' to make the the computer sleep instead

• Save the .xib file then wait 15 seconds and then restart your computer via the holding power button then pressing it after the light near it goes out and log in and the changes have been applied



[ Reply to This | # ]