This is a common thing for any chrome user. The profile of chrome gets corrupted after sometimes and you will be provided with a "Your Profile is corrupted" etc… error message, and your profile is stuck, it doesn't get saved, saved cookies, site data etc… will be gone each time you close chrome. Chrome uses sqlite3 for various databases for its profile. But sqlite3 database tends to corrupt very often, especially in case of a power failure.
Unfortunately sqlite doesn't have any native repair feature, unlike mysql. So fixing a sqlite3 means dump it and then create a new db from that dump file. Lets see how to do that with chrome's profile databases.
Close chrome and follow the instructions below in terminal.
First we need to get a list of all sqlite3 database in chrome's profile folder.
find ~/Library/Application\ Support/Google/Chrome/ -print0 | xargs -0 file | grep SQLite | sed 's/\(.*\):.*/\1/' > ~/chromedb.txt
~/Library/Application\ Support/Google/Chromewith your chrome profile path. Here i'm piping 4 commands, firstly i'm using
findto get all files from chrome profile, secondly using
xargsi'm checking file type of these files using
filecommand, thirdly filtering the SQLite databases using
grep, at-last using
sedto extract the file path part from the output. Then saving it in
Download the repairsqlite.sh script.
curl -o repairsqlite.sh https://gist.github.com/sarim/6460936/raw/repairsqlite.sh
Make it executable
chmod +x repairsqlite.sh
Now run this script with our
cat chromedb.txt | xargs -I db ~/repairsqlite.sh db
You'll see tons of text flowing through your terminal. Wait a few seconds until its done.
Now open chrome and "Profile Corrupt" message will be gone and your profile will be saved again.
Happy browsing with Chrome