Mac OS X Hints
Save time when scrolling
You probably scroll through windows and documents hundreds of times a day and use the scroll bar and scroll arrows much of the time to do it. Here are some tricks to make that easier.
First, if you use the scroll arrows at the bottom of the scroll bars to page through long documents, you can save yourself a mouse click when you want to reverse direction. Scroll bar arrows in OS X are sensitive to mouseover actions if another scroll arrow has already been activated. That means if you click and hold one scroll arrow, you can then move your mouse onto the opposite-direction arrow to immediately reverse. Before OS X, you had to first release the mouse button, move to the opposite arrow, click and hold that arrow, and wait for scrolling to commence again.
The scroll arrows need to appear together for this to be useful—there’s not much point to holding the mouse button down while you move the mouse pointer 10 inches down your screen. OS X does this by default, but the arrows appear only at the bottom of the scroll bar area, which isn’t a lot of help if your pointer is at the top. With just a tiny bit of work in Terminal (/Applications/Utilities), though, you can have the best of both worlds—double scroll arrows at both the bottom and the top of the scroll bar.
Launch Terminal and enter the following command:
defaults write "Apple Global Domain" AppleScrollBarVariant DoubleBoth
Press return to execute the command, and you’ll have enabled double arrows at both ends of the scroll bar. Note that if you’d rather not use Terminal, you can use Marcel Bresink’s freeware program TinkerTool. Any newly launched programs will display two sets of arrows, but you must quit and relaunch any programs that were running for the change to take effect (or you could simply log out and log in).
If you ever tire of this feature, the easiest way to revert is to go to the Appearance preference pane, set the Place Scroll Bars option to At Top And Bottom, and then change the Place Scroll Bars option back to Together.
Unix tip of the month
Watch system activity in real time
Have you ever wanted more detail about what your system is doing? Perhaps your hard drive thrashes or a program crashes every time you run it. Perhaps you’d like to see which files get modified when you change a program’s settings. Although there are no foolproof methods for figuring this stuff out, one option is the Unix command
fs_usagecommand reports file system activity in real time—in other words, it creates output as things happen. When launched, it starts filling your Terminal screen with output, unless you reroute the output to a text file. Here’s an example of what might appear:
08:25:15 getattrlist /Applications/iChat.app/Contents/MacOS/iChat 0.000044 MicrosoftMouse
In the first column, you see the time the system activity occurred. Next, you see the name of the file system command (in this case,
getattrlist). ( Click here for descriptions of the various commands and scroll down to Section 2.) Then you see the file involved (often this space is blank), followed by the amount of time it took the command to execute (
0.000044). Last, you see the name of the process that generated the activity. The two most interesting columns are the file involved and the name of the process. Those two values are what may help you figure out what’s happening on your system.
Here’s how I use
fs_usageto track down a problem:
1. Open Terminal and type
sudo fs_usage -w > ~/Desktop/usage.txt.
You must run
fs_usageas root; that’s why you need to type
sudo. You’ll be asked for an administrator password before you can proceed. This command redirects the
fs_usageoutput to a file, making it easy to search through when you’re done.
2. Perform the activity you’d like to investigate—launch the app that crashes, use your machine until you hear the disk churn, and so on.
3. After you’ve observed the behavior you were looking for, switch back to Terminal and press control-C to terminate
4. Switch to your desktop, and use a text editor to open the file usage.txt, which may be somewhat large. If you’re looking for something related to an application, use your text editor’s search feature to find that program’s name. If you’re trying to find the source of a lot of disk activity, look for a whole bunch of
writeentries in the output. Then look at the last column to see which program created them. If you want to find a preferences file that a program has modified, search for both the program’s name and .plist .
fs_usagecan help you do detective work. You get a detailed peek inside your system—what you see depends on what you do while the utility monitors your system. Type
man fs_usagefor more details.
[ Senior Editor Rob Griffiths is the author of Mac OS X Power Hound, Panther Edition (O’Reilly, 2004), and runs Mac OS X Hints.]