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.
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.).
- macOS with Safari iCloud Tabs enabled
sqlite3(included with macOS)jq
Install jq with Homebrew if you don't have it:
brew install jqcurl -o /usr/local/bin/safaricloudtabs \
https://raw.githubusercontent.com/shokk/homebrew-safaricloudtabs/main/safaricloudtabs
chmod +x /usr/local/bin/safaricloudtabsbrew tap shokk/safaricloudtabs
brew install safaricloudtabsHomebrew 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: 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
List all tabs in every tab group:
safaricloudtabs -lCount tabs per group:
safaricloudtabs -nFind duplicate URLs across all groups:
safaricloudtabs -dList 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 -DSearch for tabs matching a pattern:
safaricloudtabs -g 'openai|github'Count matching tabs per group (combine -n and -g in either order):
safaricloudtabs -g 'github' -nExport 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.csvExport only matching tabs as a Markdown table (-t -g; pipes escaped as with -t):
safaricloudtabs -t -g github > github-tabs.mdExport everything as CSV:
safaricloudtabs -c > tabs.csvExport as a Markdown table:
safaricloudtabs -t > tabs.mdList all tab group names:
safaricloudtabs -LList tabs in a specific group:
safaricloudtabs -s "Work"Pick a tab group interactively:
safaricloudtabs -sSafari 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.
MIT