Recover when X11 freezes while scrolling
Problem:
When using an xterm or other X11 program (e.g., vim),
aggresive (i.e., rapid and/or continuous) scrolling with the
middle mouse wheel can cause X11 to freeze. This is a known bug
in the Apple X11 software.
Solution 1:
- Start the Terminal application and issue the command:
killall -STOP X11
- Use the mouse to move the cursor into any open X11 window, and
click to select. Note that this will not produce any noticeable
effect (except possibly the spinning color wheel).
- Return the cursor to the Terminal window, and issue the
command: killall -CONT X11
- This process has the disadvantageous side effect that if you are
using a third-party virtual desktop manager, then all existing X11
windows will be gathered onto the current desktop.
Solution 2:
- Start the Activity Monitor application, and open the main
activity monitor window if it does not open by default
(Cmd-1 or Window→Activity Monitor).
- Select the X11 task in the activity monitor window, then
run the View→Sample Process function. You might need to
repeat the Sample Process function several times.
Solution 3: If all else fails, then select Force Quit from
the Apple menu, and kill the X11 program. WARNING: this will lose
changes to any unsaved files.
OS Version Compatibility: Tiger; untested in Leopard, but probably works. It's possible that this issue was fixed in 10.4.3+ and/or that it only occurs when using a Logitech USB mouse.
Change the default login shell
Problem:
The “factory set” default login shell for Mac OS X
(Panther+) is bash. Some users may wish to use other shells (e.g.,
tcsh is popular).
Tiger Solution:
To change the default shell for a particular user
account, use the application utility Netinfo Manager.
Under the “users” category in Netinfo Manager, look for the
desired login name and find the “shell” item in the list of
properties for that account. This should say /bin/bash
by default; modify it to the desired shell (e.g., /bin/tcsh).
This will require first unlocking the properties by clicking on the
lock icon and entering an admin password.
Quit Netinfo Manager, then log out of the user account and
log back in to globally initialize the new default shell.
Leopard Solution:
The application utility Netinfo Manager no longer exists in Leopard. Instead, open the “Accounts” preferences in System Preferences. Unlock the preferences by clicking on the lock icon in the lower left corner of the preferences panel and entering an administrator password. Then right-click (or control-click) on a user name and select the “Advanced Options” menu. Select the desired login shell from the pull-down menu, and click on “OK”.Log out and back in to put the change into efffect.
OS Version Compatibility: Tiger and Leopard, with different procedures (see above).
Set iChat to automatically accept incoming video invitations
Problem:
You want iChat to automatically accept any incoming
video chat invitation. This can be useful for keeping an eye on
things at home when you are away (what are my cats doing right now?)
or to help out less technologically savvy people (e.g., grandma).
In AIM, this is a standard preferences settings, but in iChat it
does not show up in the preferences menu.
Solution:
This does exist as an iChat preferences setting, but
it is a hidden preference. Issue the following command in a
Terminal or xterm (X11) window:
defaults write com.apple.ichat AutoAcceptVCInvitations 1
Repeat with “1” replaced by “0” to turn it off. The file modified by defaults
in this case is ~/Library/Preferences/com.apple.iChat.
OS Version Compatibility: Tiger; untested in Leopard, but probably works.
Make focus follow mouse in Terminal
Problem:
By default, mouse focus for Terminal is determined
by clicking on the desired window, but it is often more convenient
to have the focus automatically follow the mouse to any window.
Solution:
Issue the following command in a Terminal window and then restart Terminal:
defaults write com.apple.terminal FocusFollowsMouse -string YES
Repeat with “YES” replaced by “NO” to turn it off. The file modified by defaults
in this case is ~/Library/Preferences/com.apple.Terminal.plist.
OS Version Compatibility: Tiger and Leopard.
Make focus follow mouse in X11 (using quartz-wm)
Problem:
By default, mouse focus in X11 is determined
by clicking on the desired window, but it is often more convenient
to have the focus automatically follow the mouse to any window.
Solution:
Issue the following command in an xterm (X11) window and then restart X11:
defaults write com.apple.x11 wm_ffm -bool true
Repeat with “true” replaced by “false” to turn it off. The file modified
by defaults in this case is ~/Library/Preferences/com.apple.x11.plist.
OS Version Compatibility: Tiger and Leopard.
Enable click-through in X11 (using quartz-wm)
Problem:
Clicking on an unfocused X11 window (if you have not enabled
"focus follows mouse") or clicking on an X11 window when X11.app is in
the background will only focus the X11 window in the case of a left
click. However, any additional action implied by a click (e.g., using
a middle click to paste text selected in another X11 window - if focus
follows mouse is not enabled - or selected and copied in a non-X11
window) will not be performed and the click will not activate the
window.
Solution:
Issue the following command in an xterm (X11) window and
then restart X11:
defaults write com.apple.x11 wm_click_through -bool true
This feature allows the action implied by the click to be passed
through to the application.
Repeat with “true” replaced by “false” to
turn it off. The file modified by defaults in this case is
~/Library/Preferences/com.apple.x11.plist.
Note that focusing or activation of the
X11 window will only happen if the click would normally have focused
or activated the window. For example, a left-click (or equivalent)
will normally activate an X11 xterm window, whereas a middle click (or
equivalent) will not. However, with click-through enabled, a middle
click on an unfocused or backgrounded (i.e., inactive) X11 xterm
window will perform the expected action of pasting whatever is in the
copy buffer into the xterm window, but will not activate it (i.e.,
will neither focus the xterm window nor bring X11 to the foreground).
Some confusing click-through behavior found in Leopard 10.5.4 with
(Apple standard) X11 2.1.1:
A click-through event cannot constitute the very first command issued
into an xterm window whose initiation started X11. You must at least
once manually click to activate the xterm window (or any other X11
window currently running) before click-through will subsequently be
enabled. For example, if you type "xterm" in a Terminal.app window to
start X11 and instantiate an xterm window, then immediately click back
onto the Terminal.app window, highlight the text "xterm" using the
left mouse button (or equivalent), then try to click-through paste it
into the xterm window using the middle mouse button (or equivalent),
then nothing will happen. However, if after starting X11 and the
xterm window, you click on a non-X11 window (like a Terminal.app
window) to put X11 in the background, then click on the xterm window
to put X11 in the foreground, then again click to a non-X11 window
(like a Terminal.app window) to put X11 in the background, then any
subsequent click-through paste will transfer the contents of the copy
buffer into the xterm window command line as expected.
OS Version Compatibility: Tiger and Leopard.
Configure a large xterm window in X11
Problem:
The default xterm window in X11 is small with a very tiny font.
Solution:
Use the following command from the X11 Applications menu or the command line:
xterm -fn 10x20 -geometry 80x21 -sb -sl 1500 -vb -bg white
OS Version Compatibility: Tiger and Leopard.
Change the highlight color in Preview
Problem:
The highlight color in the Preview application is difficult to see;
also, search terms don't appear to be highlighted in the viewed document.
Solution:
Issue the following command in an xterm (X11) or Terminal window
and then restart Preview:
defaults write com.apple.Preview AppleHighlightColor "0.9137 0.7216 1.0"
The three numbers range from 0.0–1.0. The values shown here
produce light purple. To find the values for a particular color,
set the system-wide highlight color using the Appearances panel in
System Preferences, then view the AppleHighlightColor setting in
~/Library/Preferences/.GlobalPreferences.plist.
After executing a search in Preview, press Tab to shift the focus into
the main window and highlight the search term with the selected color.
Then press Cmd-G to jump forward through selected search terms using the
selected highlight color.
OS Version Compatibility: Tiger and Leopard.
Run the Mac OS X maintenance scripts
Problem:
Mac OS X is a UNIX-based system, built specifically on FreeBSD.
UNIX systems run scheduled maintenance routines to clean up a variety
of System logs and temporary files. By default, these are executed
between 03:15 and 05:30 local time, depending on the script. If your
Mac is shut down or in sleep mode during these hours, the maintenance
scripts will not run. This results in log files that will grow over
time, consuming free space on your Mac OS X startup disk. If your Mac
is shut down or left in sleep mode overnight, you should invoke these
maintenance routines manually on a regular basis.
Solution:
Manually running the maintenance scripts –
Using an admin account,
you can execute all three maintenance scripts at once by issuing the
following command in a Terminal or xterm (X11) window.
sudo periodic daily weekly monthly
All three scripts will run in sequence. There is no visual feedback
while the scripts execute.
Determining when the maintenance scripts last ran –
You can check the date and time stamps of the log files associated
with each maintenance script, which indicates when the scripts were
last executed. Use the command
ls -al /var/log/*.out
The maintenance performed by the scripts –
Each maintenance script has a specific function.
- The daily script removes old log files, “scratch”
and “junk” files,
backs-up the NetInfo database, reports a variety of system and
network statistics, and rotates the system.log file. Under Tiger,
the daily script also cleans up scratch fax files and prunes
asl.log, the log for the new Apple System Logging facility.
- The weekly script rebuilds the locate and whatis databases and
rotates the following log files: ftp.log, lookupd.log, lpr.log,
mail.log, netinfo.log, ipfw.log, ppp.log, and secure.log.
- The monthly script reports per-user usage accounting and rotates
the wtmp, install.log, and cu.modem.log files.
OS Version Compatibility: Tiger and Leopard.
Fix garbled fonts
Problem:
Fonts in PDF or postscript files appear fine on screen,
but are garbled when printed.
Solution:
- Close all applications
- Delete the /Library/Caches/com.apple.ATS folder
- Immediately restart the computer
This removes system font cache files that can become corrupted.
OS Version Compatibility: Tiger; untested in Leopard, but probably works.
Set view options for the Desktop
Problem:
The Desktop can become crowded with icons. Which one is a PDF file?
Which one is an image? Where's that file I just downloaded?
I don't know! Help me!
Solution:
Right-click (or control-click) in the Desktop background, then select Show View Options.
The options for Show Icon Preview and Keep Arranged By Kind are
especially useful.
OS Version Compatibility: Tiger and Leopard.
Rotate individual PDF pages in Preview
Problem:
Some PDF files contain a mix of portrait and landscape pages. Preview contains obvious functions (Rotate Left or Rotate Right in the Tools menu or on the toolbar) that will rotate all of the pages from one format to the other, but how can you rotate only certain pages?
Solution:
Hold down the option key before selecting Rotate Left or Rotate Right to rotate only the current page. If you save the document after applying the selective rotations, it will also save the rotations.
OS Version Compatibility: Tiger and Leopard.
Use cron to schedule automatic tasks
Problem:
How can I schedule some tasks (like backing up one disk to another) to occur automatically on a regular basis?
Solution:
The standard UNIX command cron will manage the execution of tasks on a specified schedule. The first step is to create a command-shell script that executes the desired task. For example, I use a bash script containing an rsync command that backs up the contents of my main hard drive to a secondary hard drive. Store this shell script somewhere in your home directory (the home directory on a Mac is at /Users/{login name}); for example, I want this script to be executed daily, so I created a hidden sub-directory in my home directory called .cron.daily/ and put the script file in it.
Tasks for cron to execute are listed in a crontab file. System-wide (i.e., root level) cron tasks are controlled by /etc/crontab, but for user-level tasks, a crontab file (or, in my case, a hidden .crontab file) can be created in the home directory. The format of the crontab file is like this:
| # | minute | hour | mday | month | wday | command |
| | 15 | 03 | * | * | * | sh /Users/{login name}/.cron.daily/backup.sh |
| | 15 | 03 | 1 | * | * | sh /Users/{login name}/sample1.sh |
| | 15 | 03 | * | * | 6 | sh /Users/{login name}/sample2.sh |
| | */15 | * | * | * | * | sh /Users/{login name}/sample3.sh |
The first line of the crontab file is a commented header line (indicated by a leading #). The specified tasks begin on the second line. Entries in columns are separated by tabs.
In this example, the command in the first task line (to execute my disk backup script) is executed at 03:15 (i.e., 15 minutes after 3am) on every day of the week (wday) for every day (mday) of every month (month). The asterisks are read as “every”. As further examples, the second task line would execute its command at 03:15 only on the 1st day of every month. The third task line would execute its command at 03:15 on the 6th day of every week. The fourth task line would execute its command every 15 minutes.
Allowed values for the crontab parameters are 0–59 for minute, 0–23 for hour, 1–31 for mday, 1–12 for month, and 0–7 for wday (0 and 7 are Sunday). The month and wday values can also be specified using the first three letters of the month or day name (e.g., “Jan” for January or “Thu” for Thursday). Ranges and (comma-separated) lists are allowed. For example, 8–11 in the hours column would run the associated command at hours 8, 9, 10, and 11. A list of 1,2,5,9 in the hours column would run the associated command at hours 1, 2, 5, and 9.
Once the crontab file and the associated script file(s) have been created and stored in the specified locations, you must initiate the cron process by issuing the command
crontab /Users/{login name}/.crontab
(substitute your own name for your crontab file). The command
crontab -r
will stop the execution of cron tasks. The command
crontab -l
will list all of the currently schedulued cron tasks. I have found that cron will occasionally stop on its own (possibly associated with incremental software updates to the operating system), so it is a good idea to run crontab -l occasionally to make sure that your cron tasks are still running.
OS Version Compatibility: Tiger and Leopard.
Change the default web browser
Problem:
I don't want to use Safari as my default web browser (e.g., for downloading URL-linked attachments in emails). How can I change the default web browser?
Solution:
Start Safari. Under the Safari menu, select Preferences (or type Cmd-,). In the Preferences window, select the General tab, then find and select the desired web browser under the Default Web Browser pull-down menu. This will change the default web browser for all applications.
OS Version Compatibility: Tiger and Leopard.
Make printers exit after finishing
Problem:
Under Tiger (and earlier versions), when a print job finished, the printer utility would automatically quit and the associated icon would vanish from the Dock. Under Leopard, the default behavior is for the printer utility to remain active, with its icon in the Dock. How can I make the Leopard printer utility quit when it is done printing?
Solution:
Right-click (or control-click) on the printer icon in the Dock and select “Auto-quit when done” to restore Tiger-like behavior. This apparently only needs to be done once, even if you have multiple printers installed.
OS Version Compatibility: Leopard only.
Change Dock appearance
Problem:
Aaaargh! I hate the transparent, 3-D, glossy Dock in Leopard! What can I do?
Solution:
Issue the following commands in a Terminal or xterm (X11) window:
defaults write com.apple.dock no-glass -boolean YES
killall Dock
This will convert the Dock appearance to something similar to the Tiger version (i.e., still transparent, but 2-D with no reflections). This is the same appearance that the Dock has by default in Leopard when it is configured in the Dock System Preferences to appear on the side of the screen instead of the bottom.
Repeat with “YES” replaced by “NO” to
restore the “fancy” Leopard dock appearance.
The file modified by defaults in this case is
~/Library/Preferences/com.apple.dock.plist.
OS Version Compatibility: Leopard only.
Use Front Row without an Apple remote
Problem:
Wow! Front Row is really cool! I can hardly wait to look at all of the files on my computer by flipping through a rotating display of album covers, photo thumbnails, etc. But, alas! My Mac did not come with an Apple Remote! Can I still Use Front Row?
Solution:
Yes, you can. Press Command-Escape to start Front Row. Navigate up and down with the arrow keys, select a menu item with the Enter key, go back one menu level with the Escape key. Press Command-Escape to completely exit Front Row. If Front Row freezes, press Command-Option-Escape.
OS Version Compatibility: Leopard only.
Show full directory path in Finder windows
Problem:
By default in Leopard, the title in a Finder window is set to the currently viewed folder. How can I make the title be the full directory path to that folder (i.e., similar to what would be returned by the Unix pwd command)?
Solution:
Issue the following command in a Terminal or xterm (X11) window:
defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES
Relaunch Finder (e.g., using Force Quit under the Apple menu) to put the change into effect.
Repeat with “YES” replaced by “NO” to restore the default titles. The file modified by defaults
in this case is ~/Library/Preferences/com.apple.finder.plist.
OS Version Compatibility: Leopard only.
Stop auto-switching in Spaces
Problem:
Spaces is great and all, but it forces me to sort by applications instead of tasks. For example, if I select {application} from the Dock, then it automatically switches me to the virtual desktop space in which I first started {application}. However, what I really wanted was to start another instance of {application} running in my current virtual desktop space. Assigning {application} to all desktops in the Spaces preferences isn't the solution, because then Spaces just drags around all {application} windows onto all desktop spaces.
Solution:
Issue the following command in a Terminal or xterm (X11) window:
defaults write com.apple.dock workspaces-auto-swoosh -bool NO
Restart the Dock using the following command:
killall Dock
Spaces will now allow you to start multiple instances of an application in separate desktop spaces. Note that implementing this setting can result in confusing behavior if you have used the Spaces preferences to assign a specific application to a specific desktop spaces (although assigning appplications to all desktop spaces appears to be fine).
Repeat with “NO” replaced by “YES” to restore the default behavior. The file modified by defaults
in this case is ~/Library/Preferences/com.apple.Dock.plist.
OS Version Compatibility: Leopard (10.5.2+) only.
Disable starting an initial xterm when X11.app is started
Problem:
Leopard's implementation of X11 is not intended to be started from the Applications/Utilities menu (as it was in Tiger). Instead, X11 is automatically started on demand when an X application is started. X11 can still be started by itself by double-clicking on the X11.app icon in the Applications/Utilities folder, but this will also automatically start an xterm. Under Leopard, there is no system xinitrc file that can be edited to disable starting that initial xterm. Please make it stop!
Solution:
Issue the following command in a Terminal or xterm (X11) window:
defaults write org.x.X11 app_to_run /usr/bin/true
The true routine (intentionally) does nothing (no, really – type man true and see for yourself).
Repeat with “/usr/bin/true” replaced by “xterm” to restore the default behavior. The file modified by defaults
in this case is ~/Library/Preferences/org.x.X11.plist.
(Note: Because of the new way that Leopard handles X11 compared to Tiger, you should also not configure X11 to start automatically at login, nor include it as a launcher in your Dock. Starting X11 in either of these ways will result in multiple copies of X11 running. You should also not start X11 manually - as described here - if it has already been automatically launched by Leopard.)
OS Version Compatibility: Leopard only.
Stop asking for confirmation before opening a downloaded file
Problem:
Leopard tags files downloaded from the web, and asks for confirmation before running a downloaded application or script. While this does provide a default layer of security against running downloaded programs, it is also annoying for people who already exercise an appropriate level of caution about trusting downloaded software. (Note that this feature of Leopard does not do anything with regard to checking downloaded files for viruses, preventing malicious software from running, etc. – all it does is remind you that it was downloaded - and require an extra button-click - before the application or script can start). How can I disable this behavior?
Solution:
This one is a little complicated, and a good explanation (with step by step instructions and screen-grabs) is available at http://henrik.nyh.se/2007/10/lift-the-leopard-download-quarantine. In the event that site becomes unavailable, I have reproduced the minimum necessary steps here.
First, save this file
into your ~/Library/Scripts/Folder Action Scripts/ folder:
Unquarantine.scpt.
If that folder does not exist, then create it using the Terminal or xterm (X11) command:
mkdir -p ~/Library/Scripts/Folder\ Action\ Scripts
In a Finder window, navigate to (but not into) the folder that receives web downloads (e.g., this is set to ~/Downloads by default in Leopard). Right-click on the folder icon and select More→Configure Folder Actions.... Check Enable Folder Actions. If you had to create the ~/Library/Scripts/Folder Action Scripts folder, then you will also have to add it to the Folders with Actions column, by clicking on the + button next to the Show Folder button, then navigate to, and select, the ~/Library/Scripts/Folder Action Scripts folder. Finally, attach the Unquarantine action to the folder.
This folder action script runs the command:
xattr -d com.apple.quarantine "downloaded_file.zip"
The process described here will apply the Unquaratine script to only one folder. If you download files to other folders, then you will have to apply the script to those folders also for it to take effect.
OS Version Compatibility: Leopard only.
Why doesn't X11 work right with Spaces?
Problem:
When multiple X11 windows (e.g., many xterm windows) are open on different Spaces workspaces, clicking on one of the windows or putting the cursor in the window (if "focus follows mouse" is enabled for X11) does not always activate the window.
Solution:
This is a known problem with the current implementation of X11.app (as of this writing, OS X v10.5.4 and X11 v2.1.1), which causes X11 to become confused about where windows are located when they exist on more than one Spaces workspace. The problem is that X11 treats all windows as though they exist on the same workspace; consequently, if you are trying to activate an X11 window on one workspace that is “behind” an X11 window on a different workspace, then you will actually activate the X11 window that is “in front” on the other workspace.
Starting with Leopard, Apple is using a somewhat modified version of the Xquartz open-source implementation of X11 in OS X. The Xquartz project claims to have fixed this problem as of their version 2.2; however, as of Apple's version 2.1.1 this has not yet been implemented for Leopard. See the Xquartz project web site for more information.
For now, there are two solutions to this problem, neither of which is particularly satisfying:
- Wait for Apple to implement the fix in a future update of Leopard or X11.
- Trash the Apple installation of X11 on your computer and replace it with the current version of Xquartz X11. Instructions for doing this are available from the Xquartz project web site. Note that this is not for the faint of heart. Consequences include: the OS X Software Update will no longer deliver updates to X11 (updating the Xquartz X11 requires installing updated packages from their web site), future Apple updates could disable the Xquartz X11 (requiring re-installation of the Xquartz software), names of preference files associated with X11 will change, and so on.
Odd behavior of X11 (Apple standard v2.1.1 with Leopard v10.5.4):
The org.x.x11 preferences file, although ostensibly not used by
Apple's standard X11 (but used by, for example, the non-standard
Xquartz version of X11), appears to be created when X11 starts (if it
does not exist). In addition, starting X11 with an existing version
of both com.apple.x11 and org.x.x11 will sometimes use org.x.x11 as
the preferences file, which usually results in your preferences (like
customized items in the Applications menu), which are probably stored
in the com.apple.x11 file, not being implemented. I have found that
copying ~/Library/Preferences/com.apple.x11 to
~/Library/Preferences/org.x.x11 after you set up your
preferences in
X11 will prevent the creation of a default org.x.x11 file, and will
guarantee that things like customized menu items show up regardless of
which preferences file is used by X11.
OS Version Compatibility: Leopard only.
|