Instantly share code, notes, and snippets.

What would you like to do?
Launch Chromium with API Keys on Mac OS X and Windows

Sometimes you need to use API Keys to use things like the Speech API. And then you Google a bit and follow all the instructions. But the Chromium Project's API Keys page does a not-so-great of explaining how to do this, so I will.

  1. Download Chromium.
  2. You'll notice a yellow disclaimer message appear as a doorhanger: Google API Keys are missing. Some functionality of Chromium will be disabled. Learn More.
  3. Clicking on that link takes you to the confusing API Keys docs page.
  4. If you aren't already, subscribe to the mailing list. (You can just subscribe to the list and choose to not receive any mail. FYI: the Chromium project restricts the APIs to those subscribed to that group - that is, Chromium devs.)
  5. Make sure you are logged in with the Google account associated with the email address that you used to subscribe to chromium-dev.
  6. Log in to the Google Cloud Platform, and select an existing project or press the "Create Project" button.
  7. From the project's API Manager, select the Credentials tab in the sidebar.
  8. Create a Browser API Key.
  9. You'll see a modal with an API key. Copy and paste that somewhere.
  10. Now create an OAuth Client ID.
  11. After you complete all the steps and the "content screen," you'll be presented with a modal with your Google Client ID and Client Secret.
  12. You'll need to set three environment variables:

On Windows: Launch cmd.exe and enter the following commands:

setx GOOGLE_API_KEY your_key_goes_here
setx GOOGLE_DEFAULT_CLIENT_ID your_client_id_goes_here
setx GOOGLE_DEFAULT_CLIENT_SECRET your_client_secret_goes_here

On Mac OS X / Linux: Plop these in your ~/.profile file:

export GOOGLE_API_KEY="your_key_goes_here"
export GOOGLE_DEFAULT_CLIENT_ID="your_client_id_goes_here"
export GOOGLE_DEFAULT_CLIENT_SECRET="your_client_secret_goes_here"
  1. Now launch Chromium:

    On Windows: Launch Chromium normally.

    On Mac OS X:


This comment has been minimized.

lzrski commented Feb 28, 2017

Thank you. Works as expected.

I took a liberty of republishing your answer on (with due credit), as it seems to be much easier to find there.

You may consider to use launchctl setenv command on OSX to avoid exposing keys and secrets in the shell environment (or publishing them if one is keeping dot files in public repo).


This comment has been minimized.

beardypig commented Apr 26, 2017

If you use launchctl setenv it will also work when launching Chromium from spotlight or the dock.

You can add the following to /etc/launchd.conf.

setenv GOOGLE_API_KEY "xxx"

This comment has been minimized.

luokuning commented Jun 8, 2017

Nice explanation, thanks!


This comment has been minimized.

ezeeyahoo commented Jun 17, 2017

/etc/launchd.conf method is not working under Sierra 10.12.5, left with launchctl setenv method


This comment has been minimized.

ezeeyahoo commented Jun 29, 2017

On Sierra, I am not able to do it using launchd.conf

Here is my work-around:-
1)mv /Applications/ /Applications/

2)I have created a script and placed it inside /Applications/ with name Chromium, recheck in getinfo once:-


# Set up environment variables
export GOOGLE_API_KEY=""

# Launch Chromium
  1. Give it +x permission

It is working fine.

  1. I have made another script in icloud to restore above setting after every version update

This comment has been minimized.

uBlock-user commented Jul 22, 2017

@cvan This doesn't work for built in translation for Chromium. I followed the steps and installed the keys and secret, but when I right click and click on Translate in English it fails.

To reproduce go to -

Open the context menu via a right click and click on Translate in English, it will fail with a notification from the browser

Open the console via F12 and you will find this - Failed to load resource: the server responded with a status of 403 ()

PS - This only happens to me on Chromium and not Chrome. Why ? Please explain.


This comment has been minimized.

Maxouhell commented Dec 4, 2017

Didn't work here.
I tried with MacOs and Windows 10.

Chromium doesn't show Google API Keys are missing. Some functionality of Chromium will be disabled. anymore, but I have a SpeechRecognitionError with only network description.
It's working on Chrome, and i can't find out why...

Any Idea ?


This comment has been minimized.

ezeeyahoo commented Jan 17, 2018

I have made this process lot easier for MAC


This comment has been minimized.

BasmaRG commented Feb 3, 2018

Thanks a lot, It is very useful.


This comment has been minimized.

vusdo commented Jun 1, 2018

I am using Ubuntu 16.04.
export or /etc/chrome_dev.conf I tried both, but the existing key value
It is not replaced.

I want to know how to replace api-key.


This comment has been minimized.

uBlock-user commented Aug 7, 2018

This is my followup response to my previous post where I couldn't get built in google translate to work which I finally am able to now. You need to Enable an API named Chrome Translate Element via and wait for a minute to get it working on Chromium.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment