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

A fix for 'can't find the default KCHR resource' error System
Yesterday my keyboard suddenly stopped working in anything except for authentication dialogs and the Dock (Command-Tab, Exposť, etc.). I think System Preferences had crashed while I was opening it, but I can't be sure. Luckily I had a second account I use for emergencies such as this, and so I switched across to it. The keyboard worked fine in this account.

I then went through the troubleshooting steps of renaming the Preferences folder in my broken account (using sudo in Terminal) and logging back in, but that didn't fix the problem. Renaming the Library folder, and even trying the same on my home directory, didn't fix the problem. Searching on Google produced only one hit in German. When "translated" with Google, the match suggested that reinstalling the latest combo updater might do the trick. Luckily it did.

I'm posting the information here so that if anyone else who doesn't speak German has the problem, the solution might be easier to find. The other error message you can see in the console.log is TSMProcessRawKeyCode failed (-192). I'd love to know what the problem was, and how it could only affect a single user account and yet not be a setting inside that user's home directory.

[robg adds: I can't test or confirm this one; comments as to the possible cause and alternative fixes are welcomed!]
  Post a comment  •  Comments (3)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
[5,674 views]  View Printable Version
How to perform an action on change of network System
I have a PowerBook that I move between various networks. Some of these networks have different proxy settings -- see this hint for how that can be handled.

I also had the problem that I wanted NTP to be working, and some of these networks were filtering the ntp packets. It is possible to set /etc/ntp.conf, just like a standard unix ntp daemon. Unfortunately, ntpd will decide that a bunch of the time servers are unreachable, and will stop trying. When you wake your Mac on another network, ntp will lose contact with its last servers, decide it can't do anything, and shut itself down. So I wanted to kick ntpd when I connected to a new network.

The first step was to add iburst commands to the ntp setup, and to decide that SystemStarter restart "Network Time", when run as root, would restart ntpd. I then needed a way to get ntp to be kicked when my network config changed. I found the solution to that in this blog posting: Apple's System Configuration framework keeps track of network connections and when they change. This can be accessed through the scutil command.

Initially I found scutil difficult to use. The man page is horrible, but if you run scuti and then type help at its prompt, then you get a better list of commands.
read more (242 words)   Post a comment  •  Comments (7)  
  • Currently 3.25 / 5
  You rated: 4 / 5 (4 votes cast)
[25,448 views]  View Printable Version
Drag and drop text in background windows System
Now most of you probably know about holding down the Command (Apple) key to drag a background window without bringing that window to the foreground. But you might not know about this...

I was waiting for a copy process to run one day and had Terminal open in the background, so I started fiddling as some would. I discovered that the Command key trick extends to selecting (at least text) and drag-and-dropping as well.

[robg adds: This hint describes some of the other things you can with the Command key and objects in background windows. I tested today's tip and found that it worked as described as long as the background app (where you start dragging the text) was a Cocoa app. I could, for instance, hold Command and drag a selection in a background Terminal window, then Command-drag that text to either a Cocoa or Carbon app, and drop it. At no point would either of the background apps come to the foreground. I had no luck with a Carbon app (using BBEdit and Word) as the frontmost background app -- they both came to the foreground as soon as I Command-clicked within their windows.]
  Post a comment  •  Comments (3)  
  • Currently 2.67 / 5
  You rated: 4 / 5 (6 votes cast)
[6,262 views]  View Printable Version
Auto-sync Windows XP's clock more often System
Even after trying this hint, I was still unable to get Windows XP to keep the right time. I could sync it over the internet using the Internet Time sync feature, which would fix it, but after a few hours, it would mysteriously go wrong again.

Then I found this page, which has some neat tips about adding new time servers, and (more importantly) making the automatic syncing more frequent. After changing the registry value (it mentions to a smaller value like 60; make sure you aren't in base Hexadecimal), and logging out or restarting, Windows will sync the time more frequently, correcting it when it goes wrong.

It's not the best solution, and the problem still occurs, but it shouldn't be noticeable anymore.

[robg adds: No, we won't regularly run Windows hints, but as noted on the linked tip, if they seem general enough and relate to the basic system, we will -- there are a fair number of Mac users who do run Windows on their Intel Macs, and this information can be of use to them. Note that we've only run a handful of such hints since the Intel Macs shipped, so there's no fear of the site's focus changing! :) ]
  Post a comment  •  Comments (7)  
  • Currently 1.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
[13,669 views]  View Printable Version
Revert to standard printing presets without printing System
Often, a user may set up a preset via the Print dialog box, for example, to use when printing a photo with high quality settings. If the user forgets to reset the preset to defaults, the OS does not do this for him. One way to reset this, of course, is to go to File » Print, select the default preset, and then print the document. This wastes ink, paper, and time. But if one selects the default and then clicks Cancel, the previously-selected preset will still be in effect.

The workaround is to go to File » Print, select the default preset, but then click Preview instead of Print. Once the Preview window is open, simply click Cancel; the default preset is now selected for subsequent print jobs.
  Post a comment  •  Comments (2)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
[6,115 views]  View Printable Version
Of fuzzy monitors and the zoom feature System
I've been a Mac user since the 512, yet this took me by surprise. Suddenly the type on just about everything on my desktop seemed a bit darker and a little blurry. I was convinced that my monitor was going ... or worse, the computer was not sending it the correct voltages anymore. I was minutes from getting it ready for repair, then I decided to look around a bit.

Somehow I had hit a keystroke combination which barely engaged a zoom feature -- just about 1% or so, barely off of zero. I didn't even know I had a zoom feature! I went to the System Preferences » System » Universal Access, and turned Zoom off (how did it get turned on?). This immediately brought my monitor back to the razor-sharp images I had been looking at for years. Whew! A close call, based on a very simple thing that many of us forget is even there.

[robg adds: The keyboard combo is Command-Option-Equals, and I think Zoom is enabled by default.]
  Post a comment  •  Comments (13)  
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
[13,609 views]  View Printable Version
Store Developer docs on a compressed disk image System
I just got done re-installing OS-X (an old Microsoft habit, I guess), and was installing XCode when I realized that almost half of the installation size of XCode is the documentation. I need that documentation, but hate to see 1.3 Gb of my hard drive gobbled up by something that is:
  1. Very compressible
  2. Not demanding on resources
  3. Only rarely used
So I hatched the hare-brained idea to compress it -- and it worked! I've cleaned up the code, so fire up Terminal and do this:
 $ cd /Developer
 $ sudo hdiutil create -srcfolder "ADC Reference Library" 
   -format UDBZ DevLibrary.dmg
That will build the compressed reference library in the Developer folder. Once you are done, delete the "old" reference folder, and make an empty placeholder for later:
 $ sudo rm -rf "ADC Reference Library"
 $ mkdir "ADC Reference Library"
Note: I didn't sudo the mkdir command on purpose, to keep the following Folder Action from prompting me for a password just to open the Developer documentation.
read more (280 words)   Post a comment  •  Comments (29)  
  • Currently 3.67 / 5
  You rated: 5 / 5 (3 votes cast)
[19,992 views]  View Printable Version
Add words to the spelling dictionary via AppleScript System
If you have a number of words to add to Apple's spelling dictionary, it can get cumbersome; you have to type the words into a document, then spell check and add them one at a time. Or, as detailed in this previous hint, you can open the "en" file (for English) and type them there, copying and pasting a non-printable character (represented by an upside-down question mark in the file). Until now, that is.

Now you can simply run this Applescript that I wrote. You type each word, press Enter after each word, and then click the Finished button after you're, well, finished. Then click on the dictionary file you wish to update (normally the "en" file for English), and it's done.

[robg adds: I couldn't get this one to work in my testing, but it's working for the author and others, so here it is -- please post your experiences, especially if it won't work for you and you can figure out why :). On my machine, the script works, and I can apparently add words, but they continue to show up as misspelled in my documents.]
  Post a comment  •  Comments (8)  
  • Currently 2.75 / 5
  You rated: 5 / 5 (4 votes cast)
[12,286 views]  View Printable Version
A scriptable solution to flush Access Control List entries System
If you create many access control lists (ACLs), you might want at some point to flush them all. Unfortunately, there's no single command that allows you to remove all the Access Contrll Entries (ACEs) on a file at once, you have to remove them one at a time until there's no more left. There is no elegant solution, but this one-liner will remove all ACEs for you:
until ! { /bin/chmod -a# 0 filename 2> /dev/null; } do echo -n;  done
Using the above, you could also create a small script that will recursively remove all the ACEs on a given directory:
for file in $(find $1)
  until ! { /bin/chmod -a# 0 ${file} 2> /dev/null; } do echo -n;  done
This hint was emailed to me by Alexandre B. I haven't tested it, as I don't use ACLs. If you do test it, please leave a comment on your experiences.
  Post a comment  •  Comments (7)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
[12,828 views]  View Printable Version
Show which processes are listening to which ports System
I had the recent unforunate occurence of having my machine hacked into. And no, it wasn't a security hole, but simply a really weak password that was compromised through a brute-force ssh attack. During my audit/clean-up, I was trying to figure out what all the attacker may have installed, since I initially found a shellbot perl script running under the compromised account.

When a machine is compromised, you want to see what servers it may have installed, listening on your system. To do this, you need to "identify" all of the processes running servers. Normally you do this with fuser or netstat -nlp. Unfortunately, neither work on OS X.

I finally figured out how to do this, and just wanted to post it online so others searching could find it. In Terminal, just run this command:
lsof -i | grep LISTEN
This will list all processes that are listening on your machine. That's it!
  Post a comment  •  Comments (31)  
  • Currently 3.71 / 5
  You rated: 4 / 5 (7 votes cast)
[103,371 views]  View Printable Version