Local documentation with MKDocs on MacOs - avren-gn8/home GitHub Wiki
π οΈ MkDocs on macOS
For my local documentation, I was looking for an open-source tool to create and manage my content. With MkDocs, I found a mature, widely used, and actively maintained solution.
I think this tool is worth writing an article about. Iβm still new to it and donβt have much experience yet. What tools do you use to create your documentation locally?
π What is MkDocs?
MkDocs is an open source tool for building static websites from Markdown files, designed specifically for technical documentation.
β Key Features
| Feature | Description |
|---|---|
| π Markdown-based | Write content in .md files (e.g., with Zettlr, VS Code, Obsidian) |
| π Static site output | MkDocs renders a full HTML site with navigation, search, and styling |
| π¨ Themes available | Most popular: Material for MkDocs |
| π Live preview | Use mkdocs serve to view the docs locally in your browser |
| π§ Simple configuration | Controlled via a single mkdocs.yml file |
| π No cloud required | Fully local, ideal for privacy and offline work |
π¦ Is MkDocs open source?
Yes. MkDocs is fully open source and licensed under the MIT License β free to use, modify, and redistribute.
- π GitHub: github.com/mkdocs/mkdocs
- π PyPI: pypi.org/project/mkdocs
π§ What can you build with MkDocs?
Examples include:
- Internal IT or team documentation
- Project or API documentation (e.g., GitHub projects)
- Manuals, Wikis, or checklists
- Offline technical knowledge bases
β Requirements
- macOS (e.g., Ventura, Sonoma)
- Terminal basics
- Python installed
π§ Step 1: Install MkDocs
Install MkDocs locally for your user:
pip3 install --user mkdocs
(Optional) Add the Material theme:
pip3 install --user mkdocs-material
This gives your documentation a modern, responsive design.
π§ Step 2: Make the mkdocs command available
By default, pip installs MkDocs in a directory not included in your PATH. To fix that:
a) Check install location:
python3 -m site --user-base
Example output:
/Users/yourname/Library/Python/3.11
The relevant binary path is:
/Users/yourname/Library/Python/3.11/bin
b) Add to PATH permanently (zsh):
echo 'export PATH=$PATH:/Users/yourname/Library/Python/3.11/bin' >> ~/.zshrc
source ~/.zshrc
Replace Python version if needed (
3.11).
π Step 3: Start a new MkDocs project
mkdocs new my-docs
cd my-docs
mkdocs serve
Now open: http://127.0.0.1:8000
π¨ Step 4: Enable the Material Theme
Edit mkdocs.yml:
theme:
name: material
Then restart:
mkdocs serve
π§© Alternative: Run via Python module
If you see this error:
zsh: command not found: mkdocs
β¦ you can always run MkDocs via:
python3 -m mkdocs serve
π MkDocs Awesome Pages Plugin
The awesome-pages plugin for MkDocs automatically builds navigation from your folder structure β no need to manually define nav: in mkdocs.yml.
β Open Source
- License: MIT
- Repo: github.com/lukasgeiter/mkdocs-awesome-pages-plugin
π οΈ Installation
Install with pip:
pip3 install mkdocs-awesome-pages-plugin
βοΈ Configure mkdocs.yml
Add the plugin:
plugins:
- search
- awesome-pages
β οΈ Remove the
nav:section if you use this plugin β it will otherwise be ignored.
π Folder structure & .pages files
Navigation is based on the folder structure under docs/.
Example structure:
docs/
βββ index.md
βββ installation/
β βββ prerequisites.md
β βββ setup.md
βββ usage/
β βββ start.md
β βββ features.md
β The plugin auto-generates a menu from this.
π Example mkdocs.yml with plugin
site_name: My Tech Docs
theme:
name: material
plugins:
- search
- awesome-pages
markdown_extensions:
- admonition
- toc:
permalink: true
π Further Resources
- π GitHub: mkdocs-awesome-pages-plugin
- π PyPI: pypi.org/project/mkdocs-awesome-pages-plugin