User Tools

Site Tools


General Mac Hints

a2ps and other tools

Unix has a lot of useful command-line tools, such as a2ps, still unsurpassed as a source code formatter.

To use these tools you have to install MacPorts . Then you can install a2ps by typing in the terminal

% sudo port install a2ps

Pipe dreams

a2ps sends by default a PostScript file to the printer. This does not work well. The output is shifted and smudged. Better is to open the Postscript file in Preview and then print it. This can be achieved by the command

% a2ps -o

and then open in Preview. A shorter way is to use the shell's piping.

% a2ps -o - | open -f -a Preview

will do this for you. Explanation: “-o -” will send the output of a2ps to standard output, “-f” will open from standard input, and “-a Preview” will cause Preview to handle it.

Lock screen

I know that you can automatically lock your Mac by checking the option “require a password to wake the computer from sleep or screen saver” in Security System Preferences. This means, however, that ypu have to type your password every time the screen saver has kicked in. I don't like this (especially not during presentations!), so I don't have this option checked. Nevertheless, I sometimes want to lock my computer when I leave it for a short while. The utility Keychain access provides an easy way to do this.

In the General Preferences panel of Keychain Access, check the option Show Status in Menu Bar. This will put a little padlock in the menu bar. One of its menu items is “Lock Screen”. If you don't find this quick enough, check Quickly lock your screen, where Rob Griffiths gives a neat trick to associate a keyboard shortcut with this command, together with many more ways to lock your Mac.

Example menu from Keychain Access

Kees 2009/11/03 20:51

Run PVS with Aquamacs Emacs

PVS is a Theorem Prover, an environment that assists in formally proving properties of programs, a.o. It can be downloaded from It is developed for Linux and it needs some tweaking to run it on Mac OS X. It uses emacs which is included in the standard distribution of Mac OS X, but it diverges severely from the interface Mac users are used to. Aquamacs Emacs is a version of emacs that is much easier to use.

After installing of PVS and Aquamacs, you have to edit the script that starts PVS.

  • Have the script start Aquamacs instead of ordinary emacs by adding somewhere to the beginning of the script the line
    PVSEMACS="/Applications/Aquamacs Emacs"
  • Alternatively, you could set the environment variable PVSEMACS or start the script with a command line option, like this:

./pvs -emacs “/Applications/Aquamacs Emacs”

  • The space in the path name of Aquamacs is giving trouble in the script, so enclose the occurrences of $PVSEMACS in double quotes as in the following code, around line 360 and 375 (several occurrences):
    case "$PVSEMACS" in


            ("$PVSEMACS" $flags -name pvs -xrm "pvs*title:PVS@$HOST

Then start the script from a Terminal window from its directory by


PVS commands such as x-prove will pop up a Wish (Tcl/tk) window. This will appear below all other windows and may go unnoticed. Use Cmd-Tab to find it.

RSI/CANS software

Taking regular rests while working at the computer can help prevent RSI/CANS. Free (donate) software to help you with this can be found on

Kees Superuser 2013/09/19 17:36

mac_wiki2/general_mac_hints.txt · Last modified: 2013/09/27 14:19 by keesh