Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

man does not recognise “-V”/“—version”/“-v” option to display the version on macOS 13

I recently is debugging a manpage parsing issue (detail see here: man does not work properly in macOS 13 th… - Apple Community) on latest macOS version. The manpage can be display properly with `man` on older macOS version, linux, or even `mandoc` on the macOS 13. I know that `mandoc` use a different interpreter to parse the manpage, and I suspect the problem raised by a possible different version of `man` shipped with macOS 13. However, the `man` cannot recognise the option for printing its version, as in the title, I tried `-V` `--version` and `-v`, but neither print the version. Both options will print only Usage. But `man` might not be fragmented since it can still display the build in manpage properly.


PS. I did not store my to-be-debugged manpage at the default man path, because the related command is still adding new options, and so needs the manpage to be updated to reflect the latest change.

Posted on Nov 10, 2022 8:36 PM

Reply
10 replies

Nov 11, 2022 5:48 AM in response to jimmymcheung

jimmymcheung wrote:

I recently is debugging a manpage parsing issue (detail see here: man does not work properly in macOS 13 th… - Apple Community) on latest macOS version. The manpage can be display properly with `man` on older macOS version, linux, or even `mandoc` on the macOS 13. I know that `mandoc` use a different interpreter to parse the manpage, and

I suspect the problem raised by a possible different version of `man` shipped with macOS 13. However, the `man` cannot recognise the option for printing its version, as in the title, I tried `-V` `--version` and `-v`, but neither print the version.

Both options will print only Usage. But `man` might not be fragmented since it can still display the build in manpage properly.

PS. I did not store my to-be-debugged manpage at the default man path, because the related command is still adding new options, and so needs the manpage to be updated to reflect the latest change.


I do not know if this is of any help or not...(?)


what I see in Ventura 13.0.1 copy and paste:


sudo --version 


Sudo version 1.9.5p2

Sudoers policy plugin version 1.9.5p2

Sudoers file grammar version 48

Sudoers I/O plugin version 1.9.5p2

Sudoers audit plugin version 1.9.5p2

Nov 13, 2022 6:42 AM in response to jimmymcheung

I believe that man page dot operators (e.g. .B, etc.) are expected to be in column 1 and are not supported with in-line syntax. That inline [\fB-abc\fR] needs white space around the text to appear bold:


[ \fB -abc \fR ]


In order for you to have the best man page compatibility across heterogeneous operating systems, you must code it in strict man.tmac or mandoc.tmac format. It's when you get fancy and try to bend the syntax that things go wrong.


Strict syntax may not be enough because for instance, on Ubuntu 20.04.1 LTS, the man command depends heavily on groff and may have also taken poetic license with the macro packages too. Expect differences on Solaris, AIX, and HP-UX as well. On macOS Monterey or earlier, look at:


man groff_tmac


I chose to use home brew package manager to reintroduce groff, its preprocessors, and macros back into macOS Ventura as arm64 binaries on my M1 mini.

Nov 14, 2022 4:25 AM in response to jimmymcheung

On Ventura 13.0.1, the following when using man -man foo.1:


[\fB-abc\fR]

does produce:


and whatever I said yesterday about requiring white space around the operators can be considered wrong.


It may not be possible to have a single man page that works universally across all operating systems and different implementations of man. That Germany experience in your other post suggests that.

Nov 11, 2022 5:57 AM in response to jimmymcheung

The man command in Ventura 13.0.1 has no version switch implemented in it because it is a shell script. In Monterey, it was a universal2 binary with a --version (1.6g) switch. Although mandoc is a universal2 binary, it has no version switch implemented in it either.


Note that groff and all of its preprocessors were removed in Ventura.

Nov 13, 2022 2:45 AM in response to VikingOSX

Thanks, I think the removal of groff makes my manpage unopenable on Ventura. Is there any alternative to it for inline formatted manpage on the macOS?

I use inline formatting because on macOS 12 man insert a space at where I change the line, e.g.

[
.B -abc
]

which produce (the `-abc` is bolded):

[ -abc ]

However, with the inline-format, I can archive

[-abc]

with

[\fB-abc\fR]

I want a portable and universal solution to give proper formatted man page.

man does not recognise “-V”/“—version”/“-v” option to display the version on macOS 13

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.