{"id":13427333,"url":"https://github.com/prasmussen/chrome-cli","last_synced_at":"2025-05-13T21:12:08.675Z","repository":{"id":13967158,"uuid":"16667693","full_name":"prasmussen/chrome-cli","owner":"prasmussen","description":"Control Google Chrome from the command line","archived":false,"fork":false,"pushed_at":"2025-02-23T09:50:22.000Z","size":65,"stargazers_count":2659,"open_issues_count":55,"forks_count":93,"subscribers_count":42,"default_branch":"master","last_synced_at":"2025-04-28T13:59:43.689Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prasmussen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["prasmussen"]}},"created_at":"2014-02-09T14:20:08.000Z","updated_at":"2025-04-28T10:31:19.000Z","dependencies_parsed_at":"2024-01-12T20:50:17.390Z","dependency_job_id":"f218c295-0bf1-4aa5-ab82-0e613e1b368a","html_url":"https://github.com/prasmussen/chrome-cli","commit_stats":{"total_commits":59,"total_committers":8,"mean_commits":7.375,"dds":"0.38983050847457623","last_synced_commit":"c5e4a40e6fc62e07a264ef2940ab0414a5a3cfa3"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prasmussen%2Fchrome-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prasmussen%2Fchrome-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prasmussen%2Fchrome-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prasmussen%2Fchrome-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prasmussen","download_url":"https://codeload.github.com/prasmussen/chrome-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254029008,"owners_count":22002284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T00:02:00.053Z","updated_at":"2025-05-13T21:12:03.666Z","avatar_url":"https://github.com/prasmussen.png","language":"Objective-C","readme":"# chrome-cli\n\n## Overview\n\nchrome-cli is a command line utility for controlling Google Chrome compatible browsers on OS X.\nIt is a native binary that uses the Scripting Bridge to communicate with Chrome.\nchrome-cli has been tested with the following browsers:\n\n- Chrome\n- Chrome Canary\n- Chromium\n- Brave\n- Vivaldi\n- Edge\n- Arc\n\n### Other browsers\n\nBy default chrome-cli communicates with Chrome, but you can use it with other browsers by settings\nthe `CHROME_BUNDLE_IDENTIFIER` environment variable. I.e. to use chrome-cli with Brave you can run the following command:\n\n```bash\nCHROME_BUNDLE_IDENTIFIER=\"com.brave.Browser\" chrome-cli list tabs\n```\n\nCheck the [scripts directory](scripts) for some convenient wrappers.\n\n#### How do I find the bundle identifier?\n\nThe following command will print out the bundle identifier for Brave\n\n```bash\nmdls -name kMDItemCFBundleIdentifier -raw /Applications/Brave\\ Browser.app\n```\n\n## Installation\n\n#### Homebrew\n\n```bash\nbrew install chrome-cli\n```\n\nThis will install:\n\n- chrome-cli\n- chrome-canary-cli\n- chromium-cli\n- brave-cli\n- vivaldi-cli\n- edge-cli\n- arc-cli\n\n## JavaScript execution and viewing source\n\nTo execute javascript or to view a tab's source you must first enable `View \u003e Developer \u003e Allow JavaScript from Apple Events`.\nMore details [here](https://www.chromium.org/developers/applescript). Thanks to @kevinfrommelt and @paulp for providing this information.\n\n## Usage\n\n    chrome-cli -h  (Print help)\n    chrome-cli --help  (Print help)\n    chrome-cli help  (Print help)\n    chrome-cli list windows  (List all windows)\n    chrome-cli list tabs  (List all tabs)\n    chrome-cli list tabs -w \u003cid\u003e  (List tabs in specific window)\n    chrome-cli list links  (List all tabs' link)\n    chrome-cli list links -w \u003cid\u003e  (List tabs' link in specific window)\n    chrome-cli info  (Print info for active tab)\n    chrome-cli info -t \u003cid\u003e  (Print info for specific tab)\n    chrome-cli open \u003curl\u003e  (Open url in new tab)\n    chrome-cli open \u003curl\u003e -n  (Open url in new window)\n    chrome-cli open \u003curl\u003e -i  (Open url in new incognito window)\n    chrome-cli open \u003curl\u003e -t \u003cid\u003e  (Open url in specific tab)\n    chrome-cli open \u003curl\u003e -w \u003cid\u003e  (Open url in new tab in specific window)\n    chrome-cli close  (Close active tab)\n    chrome-cli close -w  (Close active window)\n    chrome-cli close -t \u003cid\u003e  (Close specific tab)\n    chrome-cli close -w \u003cid\u003e  (Close specific window)\n    chrome-cli reload  (Reload active tab)\n    chrome-cli reload -t \u003cid\u003e  (Reload specific tab)\n    chrome-cli back  (Navigate back in active tab)\n    chrome-cli back -t \u003cid\u003e  (Navigate back in specific tab)\n    chrome-cli forward  (Navigate forward in active tab)\n    chrome-cli forward -t \u003cid\u003e  (Navigate forward in specific tab)\n    chrome-cli activate -t \u003cid\u003e  (Activate specific tab)\n    chrome-cli presentation  (Enter presentation mode with the active tab)\n    chrome-cli presentation -t \u003cid\u003e  (Enter presentation mode with a specific tab)\n    chrome-cli presentation exit  (Exit presentation mode)\n    chrome-cli size  (Print size of active window)\n    chrome-cli size -w \u003cid\u003e  (Print size of specific window)\n    chrome-cli size \u003cwidth\u003e \u003cheight\u003e  (Set size of active window)\n    chrome-cli size \u003cwidth\u003e \u003cheight\u003e -w \u003cid\u003e  (Set size of specific window)\n    chrome-cli position  (Print position of active window)\n    chrome-cli position -w \u003cid\u003e  (Print position of specific window)\n    chrome-cli position \u003cx\u003e \u003cy\u003e  (Set position of active window)\n    chrome-cli position \u003cx\u003e \u003cy\u003e -w \u003cid\u003e  (Set position of specific window)\n    chrome-cli source  (Print source from active tab)\n    chrome-cli source -t \u003cid\u003e  (Print source from specific tab)\n    chrome-cli execute \u003cjavascript\u003e  (Execute javascript in active tab)\n    chrome-cli execute \u003cjavascript\u003e -t \u003cid\u003e  (Execute javascript in specific tab)\n    chrome-cli chrome version  (Print Chrome version)\n    chrome-cli version  (Print application version)\n\n#### JSON output\n\nYou can set the environment variable `OUTPUT_FORMAT` to json to get json output.\nFor example:\n\n```\n$ OUTPUT_FORMAT=json chrome-cli list tabs\n{\n  \"tabs\" : [\n    {\n      \"id\" : 1869578516,\n      \"title\" : \"Lobsters\",\n      \"url\" : \"https://lobste.rs/\",\n      \"windowId\" : 1869578514,\n      \"windowName\" : \"Lobsters\"\n    }\n  ]\n}\n```\n\n## Examples\n\n###### List tabs\n\n    $ chrome-cli list tabs\n    [57] Inbox (1) - foo.bar@gmail.com - Gmail\n    [2147] My Drive - Google Drive\n    [2151] GitHub\n    [2161]\n    [2155] Hacker News\n\n###### Print tab info\n\n    $ chrome-cli info -t 2161\n    Id: 2162\n    Title:\n    Url: http://httpbin.org/ip\n    Loading: No\n\n###### Print tab source\n\n    $ chrome-cli source -t 2161\n    \u003chtml\u003e\u003chead\u003e\u003c/head\u003e\u003cbody\u003e\u003cpre style=\"word-wrap: break-word; white-space: pre-wrap;\"\u003e{\n      \"origin\": \"1.2.3.4\"\n    }\u003c/pre\u003e\u003c/body\u003e\u003c/html\u003e\n\n###### Extract information from page\n\n    $ chrome-cli execute '(function() { var nodes = document.querySelectorAll(\".title a\"); var titles = []; for (var i = 0; i \u003c 5; i++) { titles.push(nodes[i].innerHTML) } return titles.join(\"\\n\"); })();' -t 2155\n    High-Speed Trading Isn't About Efficiency—It's About Cheating\n    The terrifying surveillance case of Brandon Mayfield\n    Google turns on \"Download Gmail Archive\" feature\n    Learning to Code vs Learning Computer Science\n    Show HN: Crushify.org\n","funding_links":["https://github.com/sponsors/prasmussen"],"categories":["Objective-C","Other"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprasmussen%2Fchrome-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprasmussen%2Fchrome-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprasmussen%2Fchrome-cli/lists"}