Start a separate Chrome app on OSX with flags from Terminal

Chrome can be opened from the command line. And by running it from the command line you can configure Chrome with a number of options, there are several hundred possible flags which you can start Chrome with.

First of all, just to start/open Chrome from the command line instead of the Dock (or Spotlight) all you need is the path to the Chrome app binary. This is the absolute location of Chrome on Mac OS X: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome. You can copy and paste that to Terminal and it should open Chrome without any special options, or just open a new Chrome window if you already have Chrome open. You could even run it with a url as an argument to have that page opened by Chrome in a new tab if Chrome is already open.

Open a new instance of Chrome as a new user

You can have a completely separate Chrome app running, which you can then use command-tab to switch between (like in Windows) instead of the less stable command-` to switch between Chrome windows. To have a separate and new Chrome, run it with the –user-data-dir option, e.g.

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir="/tmp/james_bonds_browser"

All your secret browsing will be saved separately, so it won't share any history, preferences, or passwords with your normal browser, somewhat like Incongnito browsing. The difference is your session history will continue to be saved in the directory you specified after you close, so you can use it another time, unlike Incognito where your session will be deleted after you close the last Incognito window.

If you press control-z in the Terminal window where you are currently launching the new Chrome, the new app will freeze and you'll see something like:

[1]+ Stopped /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome

This is like sending the STOP signal to the Chrome process which is one way to conserve energy while on battery on OS X.

If you tried copying Chrome (duplicating the app inside Applications) it won't be sufficient to create a new, separate app process when launching, because it will continue to use the same sessions location which was copied over.

In OSX, there's no way to reconfigure an application to launch with special command line options (something you can do in Windows). However, you can edit the bundle for the app (making its contents in subdirectories unhidden) by right-clicking and 'Show Package Contents' and then use Prefs Editor (3rd party install) to edit the plist file. This is quite a hack, as you will need to create a new shell script and change the path of the CFBundleExecutable to run your shell script which then runs the real command with any command line options you specify. In this way, you could create a copy of the app in Applications and have a copy which runs your hacked plist which runs a shell script which opens Chrome with arguments.

Add new comment