Firefox logo

If you lose unbookmarked tabs in Firefox and for whatever reason “History->Restore Previous Session” doesn’t bring them back, all is not lost. You could regoogle them or sift through your search history.

However, there is an easier way if your system files are backed up regularly, e.g. via Time Machine. In this case, the snapshot taken during the last backup will include files Firefox uses to restore previous sessions.

For brevity, the rest of this post assumes the path to your home directory is

/home

In reality, it’s probably something like

/Users/yourname

If you’re not sure,

echo $HOME

Step 1

Unhide files in Finder.

defaults write com.apple.finder AppleShowAllFiles -bool true && osascript -e 'quit app "Finder"'

(restarts Finder).

Step 2

Look in

/path/to/backup/home/Library/Application Support/Firefox/Profiles/vrjcwd35.default/sessionstore-backups

or a similar-looking path for the backups of

previous.js
recovery.bak
recovery.js

Step 3

Find the current versions of the above files. They will probably be somewhere like

/home/Library/Application Support/Firefox/Profiles/vrjcwd35.default/sessionstore-backups

Close Firefox.

Step 4

Replace the current versions with their backups. If you reopen Firefox, “History->Restore Previous Session” still does not work.

Step 5

cd /home/Library/Application Support/Firefox/Profiles/vrjcwd35.default

You should see

sessionstore.js

Rename it to

sessionstore.old

“History->Restore Previous Session” should now work. If your system does an hourly backup, for example, you will have lost at most one hour’s worth of tabs.

Step 6

Delete

sessionstore.old

and

rehide files in Finder

defaults write com.apple.finder AppleShowAllFiles -bool false && osascript -e 'quit app "Finder"'

For more details on what you just did, see what happens when you close Firefox.

P.S. Close Firefox here means exiting the application completely, not closing tab(s) / window(s), after which “History->Restore Previous Session” is used, as supposed to “History->Recently Closed Tabs” or “History->Recently Closed Windows.”