LoginSignup
11
15

More than 3 years have passed since last update.

GoogleChromeの自動アップデートの無効化手順

Last updated at Posted at 2019-08-22

背景

Ruby + Selenium + chromedriver + GoogleChrome
でスクレイピングしていたのだが、GoogleChromeのバージョンが76系に上がったことにより、Selenium側で起動できない状況に陥ったため

ちなみに、起きているエラーは以下

session not created: Chrome version must be between 71 and 75

環境

$ ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin18]

$ chromedriver -v
ChromeDriver 2.46.628411 (3324f4c8be9ff2f70a05a30ebc72ffb013e1a71e)

chrome://version
↓
GoogleChrome
76.0.3809.100 (Official Build) (64 ビット)

GoogleChromeのバージョン確認方法については、このサイトを参考に。

chrome://settings/helpについては、開いたときに自動で最新バージョンにアップデートされてしまうので注意。

解決策

以下の2つの解決策が浮かぶ

  1. chromedriverのバージョンをあげる
  2. GoogleChromeのバージョンを固定する

試してみた

1. chromedriverのバージョンをあげる

1-1. zipをダウンロード

ここから、対象バージョンのzipを落とす

1-2. 解凍して/usr/local/bin/に配置(パスを通す)

$ unzip chromedriver.zip

$ sudo mv chromedriver /usr/local/bin

$ chromedriver -v
ChromeDriver 76.0.3809.68 (420c9498db8ce8fcd190a954d51297672c1515d5-refs/branch-heads/3809@{#864})

1-3. スクレイピングを実行してみる

Rubyの、
Element::location_once_scrolled_into_view()
この処理の部分で、
element not interactable
が頻発するようになってしまった...泣

1-4. 結論

Element::location_once_scrolled_into_view()
この処理を結構なファイルで使ってたので、調整するのも大変なため、
1. chromedriverのバージョンをあげる
の解決策を断念。

2. GoogleChromeのバージョンを固定する

Chromeの自動更新止める系の記事は古かったり、日本語でちゃんとまとまってなかったりしてなかなか答えに行き着かなかった。
まず結論はこのサイトにまとまっている。

以下を実行すればOK↓

// 現在の設定を参照
$ defaults read com.google.Keystone.Agent.plist

// 更新間隔を0にする
$ defaults write com.google.Keystone.Agent checkInterval 0

// Google更新系のフォルダを消して、ダミーを置く
[~/Libraryの対応]
$ sudo rm -R ~/Library/Google/GoogleSoftwareUpdate/
$ sudo touch ~/Library/Google/GoogleSoftwareUpdate
$ sudo chmod 444 ~/Library/Google/GoogleSoftwareUpdate
$ sudo rm ~/Library/LaunchAgents/com.google.keystone.agent.plist
$ sudo rm  -R ~/Library/Caches/com.google.Keystone*
$ sudo rm ~/Library/Preferences/com.google.Keystone.Agent.plist

[/Libraryの対応]
$ sudo rm -R /Library/Google/GoogleSoftwareUpdate/
$ sudo touch /Library/Google/GoogleSoftwareUpdate
$ sudo chmod 444 /Library/Google/GoogleSoftwareUpdate
$ sudo rm /Library/LaunchAgents/com.google.keystone.agent.plist
$ sudo rm  -R /Library/Caches/com.google.Keystone*
$ sudo rm /Library/Preferences/com.google.Keystone.Agent.plist

スクリーンショット 2019-08-23 1.09.44.png

リンク

メモ

■Googleソフトウェアアップデートとはなんぞや?

Google Software Update (a.k.a. Google Update on some of Google websites) is a program to install requested software and keep it up to date and running in the background without your knowledge on your computer

→ 私たちの測り知らない部分で、コンピュータの裏側で実行されるプログラム

in order to provide greater transparency and to make the technology available to other applications, the Google Update technology is open source
("Google Chrome Privacy Whitepaper"からの抜粋)

→ より公平な透明性を持ち、多くの他アプリケーションから利用できる技術であるために、

the Google Update technology is open source

→ google自動更新はOSSであるべきみたいな?

This leads me to Google's github under a project code name Omaha

→上記から、OSSプロジェクトが発足した?(=Omaha)

For a few good guys, this could be a tool provide seamless update with good user experience. But to bad guys, this is an open source software that could be twisted and disguised to be malware or spyware.

→ 善意ある人が使ってくれれば、この一連の仕組みでもまぁ許せる。けど、悪意ある人間に利用されたら、ただのマルウェアとかウィルスと一緒だよね。と。

■Googleソフトウェアアップデートって何してんの?

According to Google Chrome Privacy Whitepaper, Google Software Update send information such as the version of your Google Chrome (or other Google Apps), its release channel, your computer's hardware information. It also send Google information such as usage frequency and number of active profiles, etc

→ まぁ、いろんな情報を勝手に送信していまっせ。と

To be fair, all the information described seems to be harmless, but what I don't understand is why Google make it behaves like a malware? What will you think if I'm telling you that there is a piece of software that:

it install in your computer without explicit asking for your permission, nor giving the options to decline it;
it frequently sending data back to Google without your knowledge;
it can't be configured via a setting menu;
there is no uninstallation tool for you;
and it will re-install by itself if you delete it.

→ 下記についてはどう思うでしょう?マルウェアとかと一緒ではないですか?と
・持ち主の許可や、選択肢を与えずに、
・知らないところで色々と勝手に情報を送ったり、
・設定を書き換えたり、
・アンインストールしたものを勝手に再度インストールする行為

■Googleソフトウェアアップデートを無効にするには?

Here are my methods that work on Mac OS El Capitan (10.11.6) and MacOS High Sierra (10.13.2) on my Mac Mini and MacBook Pro

→ 先述の環境で止める方法を教えたげるよ

■自動更新自体をアンイストールするには??

$ sudo rm -R ~/Library/Google/GoogleSoftwareUpdate/

こいつは、手動で消してもGoogle関連のプロダクトを使うと再生成されるみたい
なので、ダミーファイルを置いてあげる必要がある

$ sudo touch ~/Library/Google/GoogleSoftwareUpdate
$ sudo chmod 444 ~/Library/Google/GoogleSoftwareUpdate

そんで、最後に関連のあるファイル達を消してあげる

$ sudo rm ~/Library/LaunchAgents/com.google.keystone.agent.plist
$ sudo rm  -R ~/Library/Caches/com.google.Keystone*
$ sudo rm ~/Library/Preferences/com.google.Keystone.Agent.plist

そうすると、アップデートが失敗するところまで確認できるとのこと。

■最後に

近い将来、~/Library配下だけではなく、全ユーザーが対象の/Libraryにも影響及ぼすでしょうと。

後日追記で
予想通り、/Libraryにも影響する形のChromeになっておりましたとのことで。
~/Library配下と、/Library配下に同じ対応をしてあげれば恐らく大丈夫でしょう。
ただ、これも今後の流れによっては対応しきれなくなるかもしれませんね。とのことです。

11
15
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
15