Skip to content

Instantly share code, notes, and snippets.

@levihuayuzhang
Last active January 14, 2023 18:15
Show Gist options
  • Save levihuayuzhang/7a2a6a7cdb0a6d0aa01229f905b9027d to your computer and use it in GitHub Desktop.
Save levihuayuzhang/7a2a6a7cdb0a6d0aa01229f905b9027d to your computer and use it in GitHub Desktop.
Use Chromium with google sync service on macOS
  1. Download your native chromium

  2. get api-key and install it follow this link

  3. Remember to add your account (that need to sync with chromium) to following group while doing 2nd step:

  1. set env vars:
  • in macOS:
launchctl setenv GOOGLE_API_KEY <your-api-key>
launchctl setenv GOOGLE_DEFAULT_CLIENT_ID <your-client-id>
launchctl setenv GOOGLE_DEFAULT_CLIENT_SECRET <your-client-secret>

Creation of a ~/Library/LaunchAgents/setenv.ChromiumSync.plist containing:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd ">
<plist version="1.0">
  <dict>
     <key>Label</key>
     <string>setenv.ChromiumSync</string>
     <key>ProgramArguments</key>
     <array>
        <string>/bin/launchctl</string>
        <string>setenv</string>
        <string>GOOGLE_API_KEY</string>
        <string>your_key</string>
        <string>/bin/launchctl</string>
        <string>setenv</string>
        <string>GOOGLE_DEFAULT_CLIENT_ID</string>
        <string>your_key</string>
        <string>/bin/launchctl</string>
        <string>setenv</string>
        <string>GOOGLE_DEFAULT_CLIENT_SECRET</string>
        <string>your_key</string>
     </array>
     <key>RunAtLoad</key>
     <true/>
  </dict>
</plist>

(with "your_key" being the corresponding Google API key)

  • in Linux:
export GOOGLE_API_KEY=<your-api-key>
export GOOGLE_DEFAULT_CLIENT_ID=<your-client-id>
export GOOGLE_DEFAULT_CLIENT_SECRET=<your-client-secret>
  1. launch your chromium and sign in, enjoy ^_^

Ref

  1. https://stackoverflow.com/questions/12165385/how-to-set-environment-variables-to-an-application-on-osx-mountain-lion
  2. https://www.chromium.org/developers/how-tos/api-keys/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment