Skip to content

Instantly share code, notes, and snippets.

@marianposaceanu
Last active August 29, 2016 22:35
Show Gist options
  • Save marianposaceanu/95edb9a9b84d579f487f to your computer and use it in GitHub Desktop.
Save marianposaceanu/95edb9a9b84d579f487f to your computer and use it in GitHub Desktop.

Update 30 August 2016

This can be fixed via:

But it breaks an important OS X function.

Safari's slow address bar and sluggish tab open action fix

Many OSX upgrades can corrupt Safari's history DB.

Result: a slow as heck address bar and sometimes sluggish new tab open action.

It seems Safari uses a simple SQLite3 db for storing history - it just needs some clean-up:

  1. Close Safari
  2. Open ~/Library/Safari and move History.db somewhere (e.g. ~/Downloads)
  3. Make a back-up of History.db (I just compressed it)
  4. Open a terminal window and navigate to the directory where History.db is
  5. Run these commands:
> sqlite3 History.db
> sqlite> .database
> seq  name             file
> ---  ---------------  ----------------------------------------------------------
> 0    main             /Users/marian/Downloads/History.db
> sqlite> VACUUM;
> sqlite> .quit
  1. Copy History.db back to ~/Library/Safari
  2. Open Safari and check if the issues are gone
  3. If the history is gone or glitchy just close Safari and replace History.db with the back-up

notes:

The VACUUM command cleans the main database by copying its contents to a temporary database file and reloading the original database file from the copy. This eliminates free pages, aligns table data to be contiguous, and otherwise cleans up the database file structure.

Credits

@marianposaceanu
Copy link
Author

note this might also do the trick at the expense of clearing cookies:

screen shot 2016-03-23 at 22 48 45

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