How to Export a man page using Mac Terminal to a file

If you want to export a man (manual) page for a command into a file, then you can make use of the Mac Terminal and make use of the output redirection symbol along with the file name that you want to export the text of the man page.

Let's take a look at an easy example:

man whoami > whoami_man_page.txt

Let me cat this file to see its content.

% cat whoami_man_page.txt 

WHOAMI(1)                   General Commands Manual                  WHOAMI(1)

     whoami – display effective user id


     The whoami utility has been obsoleted by the id(1) utility, and is
     equivalent to “id -un”.  The command “id -p” is suggested for normal
     interactive use.

     The whoami utility displays your effective user ID as a name.

     The whoami utility exits 0 on success, and >0 if an error occurs.


macOS 13.4                       June 6, 1993                       macOS 13.4

If you want to append data to the same file for other man pages, instead of > make use of >>

>Used to redirects the output of a command to a ls > man_ls.txt
>>Used to appends the output of a command to the end of a ls >> man_pages.txt
man page export to a file example macOS Terminal
Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap