Search code examples
bashmacospdfconvertersmanual

bash function for man utility not converting into PDF file


My bash function no longer works properly since migration to M2 processor.

I cannot get it to convert into a pdf file, because it keeps adding my home directory into the parameter after the -t argument. How do I fix this?

pman () {
        man -t "${1}" | open -f -a /System/Applications/Preview.app
}
man -t "${1}" | open -F -a /System/Applications/Preview.app  ping
The file /Users/name/ping does not exist.
What manual page do you want?

Solution

  •  pman() {     mandoc -T pdf "$(/usr/bin/man -w $@)" | open -fa Preview; }
    

    This is because they altered the rendering of .ps to .pdf in the preview app for Ventura.