You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

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

how to add a man page to /usr/share/man

On Catalina, how can I add a man page to /usr/share/man (or other manpage location searched in the path). I was able to install the executable in /usr/local/bin but trying to install the man page I get "Read-only file system".

https://support.apple.com/en-us/HT210650


As a work-around I can do $ man ~/pathto/theapplication.man but this is not ideal.


Google didn't help, I'm not on linux. Thanks in advance.

MacBook Air 13″, macOS 10.15

Posted on Sep 25, 2020 11:02 AM

Reply
7 replies

Sep 25, 2020 11:29 AM in response to aoc_theotherone

In either ~/.bash_profile, or ~/.zshrc (depending on your shell), add the following line to pick up the following man page locations:


/usr/local/share/man

/usr/share/man


export MANPATH="/usr/local/share/man:/usr/share/man:$MANPATH"


and then from the Terminal command line, apply either of the specific dot files (without brackets) per your current shell:


source [ ~/.bash_profile | ~/.zshrc ]


A man page in the current directory can be viewed as:

man ./htop.1



Sep 25, 2020 11:31 AM in response to aoc_theotherone

aoc_theotherone wrote:

I was able to install the executable in /usr/local/bin but trying to install the man page I get "Read-only file system".

How did you do that? Normally, when building an open source package like this, you would provide a “prefix” such as /usr/local and everything would be automatically installed there. That is actually the default install prefix for most such tools.

Sep 25, 2020 12:07 PM in response to VikingOSX

As I understand MacOS, your answer is all wrong. /usr/share/man is already in my manpath, and your proposal would break it. We are not supposed to set the MANPATH in the shell. MacOS uses a different mechanism.

$ echo ${MANPATH}

# returns nothing, i.e. not set

$ manpath

/usr/local/man:etc.:etc.


I'm not asking how to add /usr/share/man to manpath. I'm asking how to copy a file into a subfoldet there, which MacOS is not letting me.

Sep 25, 2020 12:19 PM in response to etresoft

The package came with *.h, *.c, Makefile, and theapplication.man. There was no configure or install step. I did:

$ make -f Makefile

$ sudo -i

$ mkdir /usr/local/bin

$ cp ./theapplication /usr/local/bin


This works fine for all users. I checked permissions and they are all proper. /usr/local/bin is already in the path. It's the next one that failed with "Read-only file system":

$ cp ./theapplication.man /usr/share/man/man1

N.B. /usr/share/man is already in the MacOS manpath (but not in the MANPATH environment variable).

how to add a man page to /usr/share/man

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