David,
It appears that the problem is related to the
fact that MacOSX does not really use the libreadline
(checks and you will see that it is a symlink to
libedit.)
I asked this question a year or so ago and Tom
Lane said that when the history file was closed
that the libedit did not return the right status
code.
I got rid of the error message by changing the source
to ignore the return code...
Currently I simply ignore the error message :) and
use tools that have reduced my usage of psql to
a bare minimum. ( http://homepage.mac.com/levanj )
Jerry