Skip to main content

A powerful CLI and GUI tool to save browser tabs from Safari, Chrome, and more to Markdown files on macOS.

Project description

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 Chrome as a shortcut for "Google Chrome".

  • Microsoft Edge:

    save-browser-session --browser "Microsoft Edge"
    

    [!NOTE] You can also use --browser Edge as 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:

  1. Build the package:

    uv build
    

    This generates source distribution (.tar.gz) and wheel (.whl) archives in the dist/ directory.

  2. Publish to PyPI: Make sure you have your PyPI API token set in the UV_PUBLISH_TOKEN environment variable, then run:

    uv publish
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

save_browser_session-0.1.0.tar.gz (51.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

save_browser_session-0.1.0-py3-none-any.whl (33.5 kB view details)

Uploaded Python 3

File details

Details for the file save_browser_session-0.1.0.tar.gz.

File metadata

  • Download URL: save_browser_session-0.1.0.tar.gz
  • Upload date:
  • Size: 51.8 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for save_browser_session-0.1.0.tar.gz
Algorithm Hash digest
SHA256 96d454d705c34d906024d84a5309144766f1854e269eb61f57ff8fa021beca58
MD5 2f5eacd950606c3309c8e54161ad71cf
BLAKE2b-256 59eb53a2e0f8006c4c54823edf458e2406f1ce987f3a0af2f5956c8eae1ab6ae

See more details on using hashes here.

File details

Details for the file save_browser_session-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: save_browser_session-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 33.5 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for save_browser_session-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad936572064a8c159104a8a73d1352b0d152cb89a5f0cd588a29f37279326bc5
MD5 ecbe77e4ae8a4c17b4cccaa667f04801
BLAKE2b-256 04aa37e74708457daf59447ba556f60d1c4fb60a7464128c28d598415a7d4f22

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page