Open a new Google Chrome tab (or window) via command line on Mac
Published: 2019-09-16 • Last updated: 2019-10-01
Ever been in your terminal and wanted to open a new chrome tab (or window), without actually switching to chrome? Well, it’s possible. Checkout these examples:
# Open URL in new tab
open --new -a "Google Chrome" --args "duckduckgo.com"
# Open URL in new window
open --new -a "Google Chrome" --args --new-window "duckduckgo.com"
I prefer to wrap these commands in bash functions so that I don’t have to remember their syntax:
chrome_open_tab() {
open --new -a "Google Chrome" --args $@
}
chrome_open_window() {
open --new -a "Google Chrome" --args --new-window $@
}
You can pass multiple URLs:
chrome_open_tab "duckduckgo.com" "mozilla.org" "wikipedia.org"