Skip to content

About

Inspect all of your Safari iCloud tab groups from the command line.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

safaricloudtabs

A small zsh script to inspect all of your Safari iCloud tab groups from the command line. It started as a personal itch — when you've got dozens of tab groups synced across devices, there's no easy way to see everything at once. This script reads directly from Safari's local SafariTabs.db SQLite database and gives you flexible output options.

macOS Permissions

Whatever terminal app you are using must have Full Disk Access enabled, or the script will fail with an "access denied" error when reading Safari's database.

To enable it: System Settings → Privacy & Security → Full Disk Access → toggle on your terminal app (Terminal, iTerm2, etc.).

Requirements

  • macOS with Safari iCloud Tabs enabled
  • sqlite3 (included with macOS)
  • jq

Install jq with Homebrew if you don't have it:

brew install jq

Installation

Manual

curl -o /usr/local/bin/safaricloudtabs \
  https://raw.githubusercontent.com/shokk/homebrew-safaricloudtabs/main/safaricloudtabs
chmod +x /usr/local/bin/safaricloudtabs

Homebrew

brew tap shokk/safaricloudtabs
brew install safaricloudtabs

Homebrew 6.0 sandbox bug: If the install fails with a sandbox error, prefix the install command with HOMEBREW_SANDBOX=0:

HOMEBREW_SANDBOX=0 brew install shokk/safaricloudtabs/safaricloudtabs

Usage

Usage: safaricloudtabs [option]

Show Safari iCloud tab group data from SafariTabs.db.

Options:
  -h          Show this help text and exit
  -d          List duplicate tab URLs
  -D          List the top 10 domains with more than one open tab (www. ignored)
  -n          List the number of tabs in each tab group
  -g REGEX    Grep the tab listing with the provided regex; with -c or -t, output
              only the matching tabs as CSV or a Markdown table
  -l          List all tabs as pipe-delimited output
  -t          List all tabs as a Markdown table
  -c          List all tabs as CSV
  -L          List tab group names sorted alphabetically
  -s [GROUP]  List tabs in a specific tab group; omit GROUP to pick interactively

Examples

List all tabs in every tab group:

safaricloudtabs -l

Count tabs per group:

safaricloudtabs -n

Find duplicate URLs across all groups:

safaricloudtabs -d

List the top 10 domains with more than one open tab (count first, most tabs first, ties alphabetical; www. is ignored; other options are ignored when -D is given):

safaricloudtabs -D

Search for tabs matching a pattern:

safaricloudtabs -g 'openai|github'

Count matching tabs per group (combine -n and -g in either order):

safaricloudtabs -g 'github' -n

Export only matching tabs as CSV (-g filters the same rows as alone; -c formats them; same quoting as -c):

safaricloudtabs -c -g github > github-tabs.csv

Export only matching tabs as a Markdown table (-t -g; pipes escaped as with -t):

safaricloudtabs -t -g github > github-tabs.md

Export everything as CSV:

safaricloudtabs -c > tabs.csv

Export as a Markdown table:

safaricloudtabs -t > tabs.md

List all tab group names:

safaricloudtabs -L

List tabs in a specific group:

safaricloudtabs -s "Work"

Pick a tab group interactively:

safaricloudtabs -s

How it works

Safari stores iCloud tab data in a SQLite database at:

~/Library/Containers/com.apple.Safari/Data/Library/Safari/SafariTabs.db

The script queries the bookmarks table, joining each tab back to its parent tab group, then formats the results using jq.

License

MIT

About

Inspect all of your Safari iCloud tab groups from the command line.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages