Skip to content

Kévin Dunglas

Founder of Les-Tilleuls.coop (worker-owned cooperative). Creator of API Platform, FrankenPHP, Mercure.rocks, Vulcain.rocks and of some Symfony components.

Menu
  • Talks
  • Resume
  • Sponsor me
  • Contact
Menu

Read the Linux Manual Pages on Mac and BSD, Directly From the Terminal

Posted on December 19, 2022November 14, 2024 by Kévin Dunglas

I’m a Mac user, but I use Docker, Kubernetes, and remote Linux servers a lot. I also write C programs that are primarily targeted at Linux.

As you may know, macOS is based on Darwin, a free UNIX system that shares some of its code and man pages with FreeBSD. However many commands and C functions are available on Linux, but not on Mac/Darwin/BSD, and having access to the Linux documentation directly from the Mac terminal would be very convenient. Fortunately, it’s easy to do, and this trick also works on BSD.

First, make sure you have a working Docker installation. My preferred method to install Docker on Mac is to run: brew install docker. It’s also possible to install Docker on FreeBSD.

Then, use Docker to copy the man pages of the latest version of Ubuntu Linux to your host:

docker run -v $HOME/ubuntu-man:/host-ubuntu-man ubuntu:latest bash -c 'echo y | unminimize ; apt-get install -y manpages manpages-dev manpages-posix manpages-posix-dev net-tools; cp -Rf /usr/share/man/* /host-ubuntu-man'

What does this command? Basically, it installs the common man pages in a container, then copies them on the host:

  • the -v option of docker run mounts the host directory ~/ubuntu-man in the container at the /host-ubuntu-man path
  • the container uses bash to execute the more complex script passed as parameter of the -c option at startup
  • this inline script:
    • runs the unminimize script provided by Ubuntu to restore some common man pages
    • installs some packages containing extra man pages
    • copy the content of /usr/share/man, which contains the man pages, to the host

Finally, add this line to your ~/.zshrc (if you use ZSH) or ~/.bashrc (if you use Bash):

alias lman="man -M $HOME/ubuntu-man"

This registers a new alias, lman, which uses the built-in macOS man command, but has access to the Ubuntu man pages we copied earlier! Restart your shell (or source the rc file) and try our new lman command:

lman ifconfig

It works! ifconfig doesn’t exist on Mac, but you can read its manual.

To update the man pages, just run the docker command again.

Related posts:

  1. Monter une partition Linux sous Mac OS X
  2. Connection to a MS SQL Server from Symfony / Doctrine on Mac or Linux
  3. Retrouvez l’un de mes articles dans Linux Identity n°6
  4. Solutions Linux

Leave a ReplyCancel reply

Social

  • Bluesky
  • GitHub
  • LinkedIn
  • Mastodon
  • X
  • YouTube

Links

  • API Platform
  • FrankenPHP
  • Les-Tilleuls.coop
  • Mercure.rocks
  • Vulcain.rocks

Subscribe to this blog

Top Posts & Pages

  • Symfony's New Native Docker Support (Symfony World)
  • JSON Columns and Doctrine DBAL 3 Upgrade
  • Securely Access Private Git Repositories and Composer Packages in Docker Builds
  • Develop Faster With FrankenPHP
  • Preventing CORS Preflight Requests Using Content Negotiation
  • FrankenPHP: The Modern Php App Server, written in Go
  • Generate a Symfony password hash from the command line
  • How to debug Xdebug... or any other weird bug in PHP
  • PHP and Symfony Apps As Standalone Binaries
  • Running Laravel Apps With FrankenPHP (Laracon EU)

Tags

Apache API API Platform Buzz Caddy Docker Doctrine FrankenPHP Go Google GraphQL HTTP/2 Hydra hypermedia Hébergement Javascript JSON-LD Kubernetes La Coopérative des Tilleuls Les-Tilleuls.coop Lille Linux Mac Mercure Mercure.rocks Messagerie Instantanée MySQL performance PHP Punk Rock Python React REST Rock'n'Roll Schema.org Security SEO SEO Symfony Symfony Live Sécurité Ubuntu Web 2.0 webperf XML

Archives

Categories

  • DevOps (84)
    • Ubuntu (68)
  • Go (17)
  • JavaScript (46)
  • Mercure (7)
  • Opinions (91)
  • PHP (170)
    • API Platform (77)
    • FrankenPHP (9)
    • Laravel (1)
    • Symfony (97)
    • Wordpress (6)
  • Python (14)
  • Security (15)
  • SEO (25)
  • Talks (46)
© 2025 Kévin Dunglas | Powered by Minimalist Blog WordPress Theme