LoginSignup
26
17

More than 1 year has passed since last update.

MacのターミナルからGoogle Chromeをめちゃ簡単に起動する方法

Posted at

はじめに

筆者の環境がM1なのでzshを使用しています。
bashの場合は読み替えてください。

バージョン

macOS Monterey
バージョン 12.5.1

方法

ターミナルからChromeを起動する場合は、openコマンドを使います。
openコマンドはFinderでのダブルクリック操作といったら分かりやすいでしょうか。
ディレクトリやファイル、URLを開くことができるコマンドです。

やり方としてはいくつかあって、以下のようにURLを直接指定する方法や、

$ open https://www.google.com/

アプリケーションで実行して開くこともできます。

$ open -a 'Google Chrome'

とはいえ毎回、上記のコマンドを打つのも面倒くさいので、
openコマンドをchromeとしてエイリアスに設定しておくのが良いと思います。

$ sudo vim .zshrc
.zshrc
alias chrome="open -a 'Google Chrome'"

設定を反映させます。

$ source .zshrc

あとはchromeと打つだけで、Google Chromeが起動します。

$ chrome

以上で完了です。
めちゃ簡単でしたね。

余談

ささっとHTMLファイルを開きたいなーという時にも大変便利です。
(本当は今回これを紹介したかった)

$ chrome index.html
26
17
0

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
26
17