Skip to content

Instantly share code, notes, and snippets.

@gwire
Created May 19, 2022 11:25
Show Gist options
  • Save gwire/ec87ad056937db9b132a9935cc46da72 to your computer and use it in GitHub Desktop.
Save gwire/ec87ad056937db9b132a9935cc46da72 to your computer and use it in GitHub Desktop.
Deleting phantom cloud tabs in Safari

I have Safari synchonised between my Mac and iPad.

Fow weeks an iPad search for "far cry 6 pelicans" (I needed assistance finding pelicans in a videogame) has been listed in the cloud tabs, despite being closed weeks ago.

Wiping the Safari data on the iPad and resetting the cloud syncing didn't seem to affect anything. So instead I tried removing the tab directly on the Mac.

As with most macOS data, the Safari tabs live in an sqlite database somewhere under the users home directory.

Library/Safari/CloudTabs.db has several tables, including cloud_tabs with the following schema

device_uuid TEXT,
position BLOB,
title TEXT,
url TEXT,
is_showing_reader BOOLEAN,
is_pinned BOOLEAN,
reader_scroll_position_page_index INTEGER,
scene_id TEXT

So it should be pretty easy to close Safari and just delete the phantom tab in the database.

% sqlite ~/Library/Safari/CloudTabs.db
SQLite version 3.37.0 2021-12-09 01:34:53
Enter ".help" for usage hints.
sqlite> select url from cloud_tabs;
https://duckduckgo.com/?q=far+cry+6+pelicans&t=ipad&ia=web
https://www.some-innocuous-site.com/
sqlite> delete from cloud_tabs where url like "%pelicans%";
sqlite> .exit
@gwire
Copy link
Author

gwire commented Apr 14, 2023

The location is different in macOS 13

% sqlite3 ~/Library/Containers/com.apple.Safari/Data/Library/Safari/CloudTabs.db
SQLite version 3.39.5 2022-10-14 20:58:05
Enter ".help" for usage hints.
sqlite> select tab_uuid,url from cloud_tabs;
E2487FB1-2612-4AE2-8A9C-478AA2545267|https://www.theverge.com/2023/3/28/23659191/amazon-sidewalk-network-coverage
4AECE851-F008-4083-8D65-3E5B44A5E10B|https://gist.github.com/gwire/ec87ad056937db9b132a9935cc46da72
sqlite> delete from cloud_tabs where tab_uuid="E2487FB1-2612-4AE2-8A9C-478AA2545267";
sqlite> .quit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment