Macとかの雑記帳

ページの表示に時間がかかる事が増えてきたのでキャッシュや履歴の消去を試みましたが改善しませんでした。
ググっても既に試した方法しかヒットしなかったのでWindows版や他のブラウザでのリセット、最適化のやり方を参考に「多分こんな感じでは?」と手動リセットしてみました。
すぐ忘れるのでメモ。

 

やり方

ページが長いので目次。
  1. 完全にリセットする方法
  2. 特定のファイルを削除して修復する方法
  3. データベース最適化のApplescript
  4. ファイル削除とデータベース最適化をまとめたApplescript
思いついたものなので、これが正解かどうかは知らないです。



完全にリセットして初期化する場合


Chromeを終了してから
~/Library/Application Support/Google/Chrome
フォルダと
~/Library/Preferences/com.google.Chrome.plist
をデスクトップにでも移動。

その後Chromeを起動すると新しくChromeフォルダが作られる。


デスクトップに移動したChromeフォルダ内の
Default/Bookmarks
ファイルを新規作成されたフォルダの同じ場所に移動。


このファイルは名前通りブックマーク関連のファイルのようなので、アカウントの同期を有効にしている場合は、この手順は不要。




同期の設定をしていれば設定等が元に戻ってくれますが、Chrome Web Store に無い拡張機能は入れ直さなければいけないようです。

念のため、入れてる拡張機能をリストアップ。
AutoPagerize
Evernote
Chrome用TooManyTabs
Create Link
Frame two pages
Go Extensions
Google Font Previewer
Google Quick Scroll
Google Reader Notifier (by Google)
Incredible StartPage
LastPass
Pure Reader※これだけ元に戻らなかった。
Quick Note
Resolution Test

Chromeを起動し、動作に問題なければデスクトップに移動したファイルとフォルダを捨てる。




特定のファイルを削除して修復

完全に初期化するのが嫌な場合。

下のファイルやフォルダを削除。
~/Library/Application Support/Google/Chrome/Default/Cookies
~/Library/Application Support/Google/Chrome/Default/Extension Web
~/Library/Application Support/Google/Chrome/Default/History
~/Library/Application Support/Google/Chrome/Default/History Index
~/Library/Application Support/Google/Chrome/Default/Visited
~/Library/Application Support/Google/Chrome/Default/Web Data
~/Library/Application Support/Google/Chrome/Default/Thumbnails
~/Library/Application Support/Google/Chrome/Default/Archived History
~/Library/Application Support/Google/Chrome/Default/Current
~/Library/Application Support/Google/Chrome/Default/Last Session
~/Library/Application Support/Google/Chrome/Default/Last Tabs
~/Library/Caches/Google/Chrome/Default/Cache/
~/Library/Caches/Google/Chrome/Default/Media Cache/

下のファイルを最適化。
~/Library/Application Support/Google/Chrome/Default/Login Data



ターミナルで実行する場合



sudo rm -rf ~/Library/Application*Support/Google/Chrome/Default/Cookies ~/Library/Application*Support/Google/Chrome/Default/Extension*Web ~/Library/Application*Support/Google/Chrome/Default/History ~/Library/Application*Support/Google/Chrome/Default/History*Index* ~/Library/Application*Support/Google/Chrome/Default/Visited* ~/Library/Application*Support/Google/Chrome/Default/Web*Data ~/Library/Application*Support/Google/Chrome/Default/Thumbnails ~/Library/Application*Support/Google/Chrome/Default/Archived*History ~/Library/Application*Support/Google/Chrome/Default/Current* ~/Library/Application*Support/Google/Chrome/Default/Last*Session ~/Library/Application*Support/Google/Chrome/Default/Last*Tabs ~/Library/Caches/Google/Chrome/Default/Cache/ ~/Library/Caches/Google/Chrome/Default/Media*Cache/ && sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Login*Data vacuum && sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Login*Data reindex


Chromeリセットの目次に戻る。


Applescript

上のコマンドにChromeの終了と起動を足したもの。
display dialog "Google Chrome をリセットします。" & return & return & "システムファイルを削除しますがよろしいですか?。" default button 1 with icon caution

tell application "Google Chrome" to quit

do shell script "sudo rm -rf ~/Library/Application*Support/Google/Chrome/Default/Cookies ~/Library/Application*Support/Google/Chrome/Default/Extension*Web ~/Library/Application*Support/Google/Chrome/Default/History ~/Library/Application*Support/Google/Chrome/Default/History*Index* ~/Library/Application*Support/Google/Chrome/Default/Visited* ~/Library/Application*Support/Google/Chrome/Default/Web*Data ~/Library/Application*Support/Google/Chrome/Default/Thumbnails ~/Library/Application*Support/Google/Chrome/Default/Archived*History ~/Library/Application*Support/Google/Chrome/Default/Current* ~/Library/Application*Support/Google/Chrome/Default/Last*Session ~/Library/Application*Support/Google/Chrome/Default/Last*Tabs ~/Library/Caches/Google/Chrome/Default/Cache/ ~/Library/Caches/Google/Chrome/Default/Media*Cache/ && sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Login*Data vacuum && sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Login*Data reindex" with administrator privileges

tell application "Google Chrome" to activate


Chromeリセットの目次に戻る。


データベースの最適化とキャッシュの削除

多分データベースを最適化してくれるもの。
display dialog "Google Chrome をリセットします。" & return & return & "システムファイルを削除しますがよろしいですか?。" default button 1 with icon caution
tell application "Google Chrome" to quit
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Web Data" then
do shell script"sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Web*Data vacuum" with administrator privileges
end if
end tell

tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Thumbnails" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Thumbnails vacuum" with administrator privileges
end if
end tell

tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/History" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/History vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Login Data" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Login*Data vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Archived History" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Archived*History vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Cookies" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Cookies vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Extension" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Extension vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Web Data" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Web*Data reindex" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Thumbnails" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Thumbnails reindex" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/History" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/History reindex" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Login Data" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Login*Data reindex" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Archived History" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Archived*History reindex" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Cookies" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Cookies reindex" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Extension" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Extension reindex" with administrator privileges
end if
end tell
do shell script "sudo rm -rf ~/Library/Caches/Google/Chrome/Default/Cache/ ~/Library/Caches/Google/Chrome/Default/Media*Cache/" with administrator privileges
tell application "Google Chrome" to activate


Chromeリセットの目次に戻る。


ファイル削除とデータベース最適化

上の2つを一つにまとめたもの。ダイアログからどちらかを選択する。
display dialog "Google Chrome を修復します。" & return & return & "修復方を選んでください。" buttons {"最適化する", "リセットする", "キャンセル"} default button 1 with icon caution
copy the result as list to {bp}
if the bp is "最適化する" then
tell application "Google Chrome" to quit
display dialog "Google Chrome をリセットします。" & return & return & "システムファイルを削除しますがよろしいですか?。" default button 1 with icon caution
tell application "Google Chrome" to quit
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Web Data" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Web*Data vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Thumbnails" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Thumbnails vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/History" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/History vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Login Data" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Login*Data vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Archived History" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Archived*History vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Cookies" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Cookies vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Extension" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Extension vacuum" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Web Data" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Web*Data reindex" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Thumbnails" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Thumbnails reindex" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/History" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/History reindex" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Login Data" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Login*Data reindex" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Archived History" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Archived*History reindex" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Cookies" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Cookies reindex" with administrator privileges
end if
end tell
tell application "System Events"
if exists file "~/Library/Application Support/Google/Chrome/Default/Extension" then
do shell script "sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Extension reindex" with administrator privileges
end if
end tell
do shell script "sudo rm -rf ~/Library/Caches/Google/Chrome/Default/Cache/ ~/Library/Caches/Google/Chrome/Default/Media*Cache/" with administrator privileges
tell application "Google Chrome" to activate
else if the bp is "リセットする" then
tell application "Google Chrome" to quit
do shell script "sudo rm -rf ~/Library/Application*Support/Google/Chrome/Default/Cookies ~/Library/Application*Support/Google/Chrome/Default/Extension*Web ~/Library/Application*Support/Google/Chrome/Default/History ~/Library/Application*Support/Google/Chrome/Default/History*Index* ~/Library/Application*Support/Google/Chrome/Default/Visited* ~/Library/Application*Support/Google/Chrome/Default/Web*Data ~/Library/Application*Support/Google/Chrome/Default/Thumbnails ~/Library/Application*Support/Google/Chrome/Default/Archived*History ~/Library/Application*Support/Google/Chrome/Default/Current* ~/Library/Application*Support/Google/Chrome/Default/Last*Session ~/Library/Application*Support/Google/Chrome/Default/Last*Tabs ~/Library/Caches/Google/Chrome/Default/Cache/ ~/Library/Caches/Google/Chrome/Default/Media*Cache/ ~/Library/Preferences/com.google.Chrome.plist && sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Login*Data vacuum && sudo sqlite3 ~/Library/Application*Support/Google/Chrome/Default/Login*Data reindex" with administrator privileges
end if
tell application "Google Chrome" to activate


Chromeリセットの目次に戻る。


...もっと良い書き方があるはず。




参考Link:Firefoxの高速化に成功!~原因は分かったが対策となるとどうしたもんだろう?

スポンサード リンク