TODO
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.
- Descibe how to add a custom icon to your new Chromium instance