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

Change the format of the menubar date display Desktop
The following was contributed by "Silver", who writes:

"I have been getting annoyed that the date format of the menuling (the date which displays when you click on the menubar clock) is forced on us as American, no matter what the international preference pane promises to store it as. So I fixed it, with a little help from a friend who told me about the chown UNIX command."

This is probably one of the most popular questions I've received here lately. So if you'd like to set the format of the menubar date to your personal choice, read the rest of the article. While not strictly required for this hint, having the Developer Tools installed will make it easier.

Customizing your menubar date format:
  1. Open the Terminal and type:
    cd /System/Library/CoreServices/Menu\ Extras/
    cd Clock.menu/Contents/Resources/English.lproj/
    [NOTE: Shown on two lines for a narrower article display; you can obviously enter this as one long 'cd' command].

  2. Then change the permissions on the Localizable.strongs file, perhaps easiest is chown:
    sudo chown username Localizable.strings
    That is if your short username was 'fred', you'd type:
    sudo chown fred Localizable.strings
    It should then ask for your password, enter it.

    An alternative to chown'ing the file is Pseudo, a $15 shareware package which allows you to run any application as root from your normal user account. Drop PropertyList Editor or the text editor of your choice onto the Pseudo icon, enter your admin password, and the dropped application runs with root privileges, allowing you to directly edit files owned by root in the Finder.

  3. If you don't have the Dev Tools installed, you'll need to navigate to the Localizable.strings file in the Finder first -- open the application bundle by control-clicking it and selecting "Show Package Contents", then open Contents -> Resources -> English.lproj, revealing the Localizable.strings file. Drag and drop this file onto your text editor of choice (launch it if it's not already running). If you have the Dev Tools, skip this step.

  4. Now open Localizable.strings with PropertyList Editor (located in Developer/Applications). If you have a good text editor that should work as well, but I had no luck with BBedit, something to do with Unicode I think. Since you 'chowned' the file (or because you're running your editor as root through Pseudo), you'll have the ability to save your changes. One advantage of PropertyList Editor over a standard editor is that you can use the File -> Open menu to navigate into the application bundles and open the bundled files directly.

  5. Look for the entry for MBC_DATETIME_MENUITEM_FORMAT, which will have a lot of % symbols in its value. The format does obey the standard UNIX date formats. I'm using %A, %d %B %Y which gives me it in the format "Saturday, 17 November 2001", which is my personal preference. Type man strftime in the Terminal for all the choices. You can also include straight text, e.g. "Today is...".

    You may wish to play around with the settings in a terminal window first to determine what you like. To do that, just type date "+%option %option text whatever", where each %option is replaced by one of the formatting pairs from 'strftime' and text whatever is optionally any raw text you'd like to see. When you hit ENTER, you'll see the date displayed in your described format. My personal choice, since I have the menubar clock already displaying the day of the week, is simply "%b %d, %Y" which results in what you see in the image at the top of this article. Note that you need to include the + sign and the quotes in the Terminal, but you do not include either when editing the file!

  6. If you used Pseudo, you can skip this step. Once you've saved your changes, close PropertyListEditor and go back to the terminal. Hit the up arrow until it shows:
    sudo chown username Localizable.strings
    Replace username with the word root so it looks like this:
    sudo chown root Localizable.strings
    and press return. This sets the privileges back to the way you found them. If you're planning on editing it again, you may just want to leave yourself as the owner.

  7. Finally, log out and in again to see your changes. If you dislike logging out and in due to the time it takes, the quickest but perhaps not safest way to see the changes take effect is to kill the SystemUIServer, which is responsible for displaying the menubar. It will quit and restart automatically, reflecting your new settings. To do this, type
    ps ax | grep SystemUIServer
    The first item in the list is the one you want to kill; note the number in the first column and type
    kill some_number
    where some_number is replaced by the number you just noted. You'll see the menubar disappear and reappear, and your changes should have taken effect.
Thanks to Silver for this hint, as I've been wanting to make this change for quite a while on my machine! While there are quite a few steps listed here, this is actually a very easy modification to make, especially whith Pseudo (a worthy $15 product, given how much time it's saved me!) and PropertyList Editor.
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[10,202 views]  

Change the format of the menubar date display | 18 comments | Create New Account
Click here to return to the 'Change the format of the menubar date display' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Why not just sudo?
Authored by: nullprogram on Nov 17, '01 11:37:59AM
If you need to run some Aqua app as root, just use sudo appname!

ie: sudo open /Developer/Applications/PropertyListEditor.app

[ Reply to This | # ]
Doesn't work...
Authored by: robg on Nov 17, '01 12:17:04PM

As of the Security Update, 'sudo open' no longer opens the GUI apps as root. I just tried it again to make sure, and while you can open the Localizable Strings file, you won't be able to save the changes. Pseudo works around this limitation.

I'm not aware of another means of doing this from a shell ... anyone?

-rob.



[ Reply to This | # ]
Re: Doesn't work...
Authored by: saint.duo on Nov 17, '01 12:41:28PM

the only way I would know how would be to enable the root account, "su" up to root from the terminal, and open property list editor from there.



[ Reply to This | # ]
Re: Doesn't work...
Authored by: nullprogram on Nov 18, '01 04:30:28AM
Even using su - failes to open gui apps as root. open seems to be the cause. You have to run the executable in the MacOS folder in the package to open it as root.

[ Reply to This | # ]
Doesn't work...
Authored by: vajonez on Nov 17, '01 05:02:05PM
Alternatively, you could simply change the permissions of the file. It starts out as owned by user "root" and group "wheel" with a permissions mode of 644 (rw-r--r--). All you need to do is give the group write permission with:

   sudo chmod g+w <path_to>/Localizable.strings

where <path_to> is replaced by the actual path to the file mentioned in the article.

Now simply open the file with the property list editor and save it. No need to change the owner or run the editor as root.

AFAIK all admin users (i.e., ones that can use sudo) are in the "wheel" group.

[ Reply to This | # ]
Doesn't work...
Authored by: GaelicWizard on Oct 07, '02 06:54:39PM

FYI, only users in the admin group, not the wheel group, can use sudo, but it doesn't matter b/c sysprefs automatically adds admin users to both groups. :)



[ Reply to This | # ]
FIXED: Why not just sudo?
Authored by: nullprogram on Nov 18, '01 04:26:48AM
sudo /Developer/Applications/PropertyListEditor.app/Contents/MacOS/PropertyListEditor "/System/Library/CoreServices/Menu Extras/Clock.menu/Contents/Resources/English.lproj/Localizable.strings"



This works. I'm working on a free script called sopen that will replace sudo open. It will re-introduce the old sudo open security issues, but at least you will know that it is insecure when you use it.

[ Reply to This | # ]
Easier way without the Terminal
Authored by: TeeGate on Nov 17, '01 04:57:57PM

This is a great tip, but for those of us who think the Terminal reminds them of Windows, who likes more detail, and an easier way, try this.

Log into root. Follow the path to:

System/Library/CoreServices/Menu Extras/ Clock.menu

Hold down the Control Key, click on the Clock.menu file and choose "Show Package Contents".

Follow the path to:

Contents/Resources/English.lproj/Localizable.strings

Make a copy of the Localizable.strings file in he event you don't like your changes.

Drag the Localizable.strings file onto TextEdit.

Where it says "MBC_DATETIME_MENUITEM_FORMAT" = "%A %1m/%e/%Y %1I:%M%p";;

Change it to "MBC_DATETIME_MENUITEM_FORMAT" = "%b %d, %Y";;

The above change will have it display like this: Nov 17, 2001

Save your changes and Log into your name and view the results.

In the event you do not like your changes, log back to root and replace the file with the original you made a copy of.

Guy



[ Reply to This | # ]
GUI way without logging out
Authored by: robg on Nov 17, '01 06:40:35PM

First, I'll admit my bias. I despise logging out. It means shutting down 20+ applications, which takes time. And then it means trying to remember what I was doing when I get back. I also dislike logging in as root. Way too easy to do something stupid to my machine. So I do everything I can to never log out and never login as root.

If you don't like the terminal, you could still do everything you need to do without logging in as root.

Navigate in the Finder as you said, option-drag localizable strings to the desktop (you can copy it, you just can't change it) to make a backup, then follow the original tip and use Pseudo to open the original file as root.

About the only thing you wouldn't be able to do this way is replace the original file if you mess up. That would require the Terminal or logging in as root.

-rob.



[ Reply to This | # ]
GUI way without logging out
Authored by: TeeGate on Nov 17, '01 07:27:42PM

Certainly a great suggestion. A shareware fee must be paid for Pseudo, but the freeware Skeleton Key could also be used.

Guy



[ Reply to This | # ]
That's why I like OS X ...
Authored by: robg on Nov 17, '01 08:13:23PM

... so many ways to accomplish the same thing! :-)

Good thought on Skeleton Key; I'd forgotten about that one!

-rob.



[ Reply to This | # ]
My way (clean, GUI)
Authored by: nagani on Nov 18, '01 12:12:21AM

This is how you can do the trick, with GUI all the way through, without messing with system files and without any root privilege:

1. Copy Clock.menu somewhere in your home zone. (Drag it where you want it to be, the Finder will make the copy for you if you are not "root".) You are now the owner of the files.

2. Launch PropertyListEditor.

3. In PropertyListEditor, select menu File - Open...

4. Navigate to Localizable.strings in your copy of Clock.menu and do your changes. (I use "%A, %B %e" to get the weekday and the date: Saturday, November 17; I know the year...) Save your changes.

5. Command-click on the clock in the menu and drag it away, it will vanish in a puff of smoke.

6. Drag your copy of Clock.menu where you want the clock to appear in the menu bar.

7. Restart your beloved machine, et voilĂ !

Do you remember that a year ago everyone was complaining that OS X would not be as easily customizable as OS X... If I may quote Rob, "This is why I like OS X... so many ways to accomplish the same thing! :-)" :-)
________
(For some obscure reason, the Finder will not let me navigate inside the Contents of my copy, although all file permissions seem to be right, I have to use the "Open" menu in PropertyList Editor... Anyone has a hint?)



[ Reply to This | # ]
My way (clean, GUI)
Authored by: TeeGate on Nov 18, '01 07:38:43AM

Nagani,

Thanks for the great tip. I like the idea that you know the year. I changed mine to match. Is this possible to do so that each user can have their own settings? My daughters liked the hack, but are not certain they liked my settings, so I want them to have their own choice if possible.

Guy



[ Reply to This | # ]
I just realized your tip does allow multiple user settings!
Authored by: TeeGate on Nov 18, '01 07:56:05AM

Nagani,

I just realized your tip does allow multiple users to have different setting. Thanks, it worked great.

Guy



[ Reply to This | # ]
Snard: Open as administrator
Authored by: nagani on Nov 18, '01 12:23:33AM

You can also use Snard ($7 shareware) to open any application as administrator. It will also give you a great launch menu...

But you don't need privileges to customize you clock: see my other post in this thread.

So many ways...



[ Reply to This | # ]
security update
Authored by: jimr on Nov 18, '01 08:37:23AM

since the security update, you should not be able to open GUI apps as root from the terminal.

Pseudo1.1bx has a workaround....

maybe snard too...

-----------------
kill me if I am wrong...



[ Reply to This | # ]
Mine is fine...
Authored by: BenK1342 on Oct 08, '02 08:16:36PM

I'm using 10.2, and the date in my clock's menu has always been the way I like it...8 Oct 2002...Anyone know why this doesn't apply to me?



[ Reply to This | # ]
Never mind...
Authored by: BenK1342 on Oct 08, '02 08:18:09PM

I just realized how old this comment is...Sorry



[ Reply to This | # ]