Save Browser Session
A robust Python CLI tool for macOS to save your open browser tabs into a formatted Markdown file. It serves as a modern replacement for complex AppleScript/JXA scripts.
Features
- Multi-Browser Support: Works with Safari, Google Chrome, Microsoft Edge, Arc, Orion, Brave, Vivaldi, and more.
- Smart Cleaning: Automatically removes tracking parameters, fixes messy titles, and cleans up URLs.
- Broken Tab Fixer: Detects "Loading..." or "Untitled" tabs and offers to reload/fix them before saving.
- Rich CLI: Beautiful terminal interface with status spinners and tables.
- Headless Mode: Automatic GUI dialog fallback (via native macOS dialogs) when running from Shortcuts or Keyboard Maestro.
Installation
Install the package directly from PyPI using uv:
uv tool install save-browser-session
Or run it directly without installing:
uv tool run save-browser-session
Development Installation
If you are developing or running from the source repository:
uv tool install .
Or, clone and run it directly from the source directory:
git clone https://github.com/rapjul/save-browser-session-macos
cd save-browser-session-macos
uv run save-browser-session
Usage
Basic Usage
Save all tabs from the frontmost browser:
save-browser-session --all
This will copy the result to your clipboard and save a Markdown file to the current working directory (configurable in source).
Options
| Flag | Description |
|---|---|
--current, -c |
Save only the current window (ignores other windows). |
--autosave |
Run in silent mode. Saves to .../Browser Sessions/Autosaved. Perfect for cron jobs. |
--include-empty |
Include tabs that are normally skipped (e.g. "Start Page"). |
--browser <Name> |
Force specific browser (e.g. "Google Chrome"). |
--gui |
Force GUI dialogs even when running in a terminal. |
Examples
Save only current window:
save-browser-session --current
Run silently in background (Autosave):
save-browser-session --autosave
Browser-Specific Commands
To target any of the other supported macOS browsers explicitly, use the --browser (or -b) flag:
-
Safari:
save-browser-session --browser "Safari"
-
Google Chrome:
save-browser-session --browser "Google Chrome"
[!NOTE] You can also use
--browser Chromeas a shortcut for "Google Chrome". -
Microsoft Edge:
save-browser-session --browser "Microsoft Edge"
[!NOTE] You can also use
--browser Edgeas a shortcut for "Microsoft Edge". -
Brave Browser:
save-browser-session --browser "Brave Browser"
-
Arc:
save-browser-session --browser "Arc"
-
Orion:
save-browser-session --browser "Orion"
-
Vivaldi:
save-browser-session --browser "Vivaldi"
-
Chromium:
save-browser-session --browser "Chromium"
-
Opera:
save-browser-session --browser "Opera"
Firefox - No Support
[!WARNING] Firefox is not supported. Unlike Safari and Chromium-based browsers, Firefox lacks native support for macOS AppleScript or JavaScript for Automation (JXA) dictionaries. As a result, external tools cannot programmatically query Firefox for active window and tab information (titles/URLs). You can track this long-standing limitation on Mozilla's Bugzilla: Bug 125419 - Add AppleScript support to Firefox.
Open Saved Files
You can automatically open the saved Markdown file in your favorite editor:
# Open in a specific app (e.g., TextEdit)
save-browser-session --open-with TextEdit
# Open in VS Code
save-browser-session --open-with "Visual Studio Code"
# Open in Antigravity
save-browser-session --open-with "Antigravity"
# Use a custom application name
save-browser-session --custom-open-with "Sublime Text"
# Use a custom application name
save-browser-session --custom-open-with "Zed"
Publishing to PyPI
This package is built and published using uv:
-
Build the package:
uv buildThis generates source distribution (
.tar.gz) and wheel (.whl) archives in thedist/directory. -
Publish to PyPI: Make sure you have your PyPI API token set in the
UV_PUBLISH_TOKENenvironment variable, then run:uv publish
Metadata
Release files for save-browser-session 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| save_browser_session-0.1.0.tar.gz | 51.8 kB | Without provenance | Details for save_browser_session-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| save_browser_session-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for save_browser_session-0.1.0-py3-none-any.whl |
Total release size: 85.4 kB
Release files / save_browser_session-0.1.0.tar.gz
| Download URL | save_browser_session-0.1.0.tar.gz |
|---|---|
| Size | 51.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96d454d705c34d906024d84a5309144766f1854e269eb61f57ff8fa021beca58
|
|
BLAKE2b-256 checksum How to use checksums |
59eb53a2e0f8006c4c54823edf458e2406f1ce987f3a0af2f5956c8eae1ab6ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / save_browser_session-0.1.0-py3-none-any.whl
| Download URL | save_browser_session-0.1.0-py3-none-any.whl |
|---|---|
| Size | 33.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad936572064a8c159104a8a73d1352b0d152cb89a5f0cd588a29f37279326bc5
|
|
BLAKE2b-256 checksum How to use checksums |
04aa37e74708457daf59447ba556f60d1c4fb60a7464128c28d598415a7d4f22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for save-browser-session 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.