Skip to content

Instantly share code, notes, and snippets.

@nrocco
Last active October 14, 2017 14:43
Show Gist options
  • Save nrocco/d1f37eca1eba5d56a04d4b6ea17ed020 to your computer and use it in GitHub Desktop.
Save nrocco/d1f37eca1eba5d56a04d4b6ea17ed020 to your computer and use it in GitHub Desktop.
Dedicated Chromium Instance With Socks Proxy on macOS

How it works

TODO

setting it up

In the following code snippets the following two variables are used

NAME="Staging"
PROXY="socks://xx.xx.xx.xx:1080"

Where $NAME is the suffix of your copy of Chromium. If $NAME is FooBar your instance of Chromium will be called ChromiumFoobar.

First copy your existing Chromium instance to a new directory:

cp -r "/Applications/Chromium.app" "/Applications/Chromium${NAME}.app"

Add a wrapper shell script that starts the chrome binary with some additional command line flags, including the socks proxy configuration:

cat <<EOF | tee "/Applications/Chromium${NAME}.app/Contents/MacOS/wrapper.sh"
#!/bin/sh
TMPDIR="\$(mktemp -d)"
"\$(dirname "\$0")/Chromium" --no-default-browser-check --proxy-server="${PROXY}" --user-data-dir="\${TMPDIR}/data" --disk-cache-dir="\${TMPDIR}/cache"
rm -rf "\${TMPDIR}"
EOF

chmod +x "/Applications/Chromium${NAME}.app/Contents/MacOS/wrapper.sh"

The final step is to adjust some names and identifies in the Info.plist file to make sure that macOS sees your application as a new instance. This is important if chrome is also your default browser and you want to browse the web and your sock proxy at the same time:

plutil -replace CFBundleDisplayName -string "Chromium${NAME}" "/Applications/Chromium${NAME}.app/Contents/Info.plist"
plutil -replace CFBundleExecutable -string "wrapper.sh" "/Applications/Chromium${NAME}.app/Contents/Info.plist"
plutil -replace CFBundleIdentifier -string "local.Chrome${NAME}" "/Applications/Chromium${NAME}.app/Contents/Info.plist"
plutil -replace CFBundleName -string "Chromium${NAME}" "/Applications/Chromium${NAME}.app/Contents/Info.plist"

That's it.

extras

  • Descibe how to add a custom icon to your new Chromium instance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment