Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to the Power Users community on Codidact!

Power Users is a Q&A site for questions about the usage of computer software and hardware. We are still a small site and would like to grow, so please consider joining our community. We are looking forward to your questions and answers; they are the building blocks of a repository of knowledge we are building together.

Find and close last opened tab in Safari

+2
−0

Finding and opening the last open tab in Safari, is usually straightforward; just look in the user interface. However, that's not an option, because every time the browser is started, it opens every previous window and tab, and begins loading up infinite memory, 150+ GBs, until the system runs out. The quick solution would be to find the caches and delete them all. Although, I want to keep my tabs.

The infinite memory bug is usually a result of clicking on the tab overview; that makes the browser attempt to load in every tab and display them. A quick restart brings the browser back to its previous state. This time, however, the issue started occuring as I opened some webpage. Thus I hope that by deleting that webpage from Safari's cached open pages, I can restore the browser to its previous, working, state.

Where do I find this cache, and how do I navigate it? I have found these files:

/Users/<current>/Library/Saved Application State/com.apple.Safari.savedState
  - data.data
  - windows.plist

The property list file seems to contain a list of the application's last known window and tab state, amongst other unknown data. If this is the right place to go, how do I locate the offending tab/webpage and delete it from the entry without causing more issues?

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

1 answer

+1
−0

Warning: this will result in the entire window the tab was located in, to be deleted

Warning: windows.plist is invalid without its data.data file. Back up both before proceeding.

Skip the first two steps if you remember the name of the tab.

  1. Find and inspect ~/Library/Safari/History.db


    A suitable application is DB4S, which can be installed with brew install --cask db-browser-for-sqlite

  2. Inspect history_visits and sort by visit_time to find the latest entry. Use title in the next step.

  3. Open ~/Library/Saved Application State/com.apple.Safari.savedState/windows.plist

  4. Search for the page title from the previous step. It's the value for an NSTitle key. Once found, delete the enclosing dict.

  5. Start Safari. Every window except the one with the latest tab should now open. The window is likely lost because data.data now has a mismatch with entries for that window in windows.plist.

The window may be recoverable by using the application menu to choose to open the last closed window. I made too many mistakes in the process and lost this chance.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »