Problem: Ok not really a problem, but I want to be able to launch Google Chrome straight to Incognito mode from a shortcut. This is useful when logging into multiple bank accounts, Google Apps accounts, or testing session based websites. etc etc etc.
Fix: Thankfully the Google Chrome.app can be launched with the –incognito switch to do just that. The terminal command to do this, assuming the browser is sitting in /Applications/ is this:
open -a /Applications/Google Chrome.app --args --incognito
Note: –args has to be passed to satisfy the ‘open’ command’s arguments first.
Launching it from a shortcut: If you want to create a shortcut to do this, open AppleScript Editor and enter the following:
tell application "Terminal" activate do script "open -a /Applications/Google\ Chrome.app --args --incognito;" delay 1 quit end tell
Note: The space in the Google Chrome.app name must be double-escaped with two backslashes like that to work. Also, without the delay I found that the script exits too quickly or something like that, and it doesn’t work.
Save the above script as an Application, and call it something like ‘Incognito’. Running this app will launch Terminal, Chrome Incognito, then exit Terminal. Bingo!
Giving your Incognito app an Icon: I’ve added the app to my Dock, and given it a special icon (see below for a downloadable PNG icon). To do this:
- Open the image you want to use as the icon – it should be a 512×512 24bit PNG if possible – and copy the image to the clipboard. If you are using Preview to view the image, do cmd+a to select all, then cmd+c to copy it… this works for most other graphics packages also.
- Locate the app you created above in Finder, then press cmd+i to bring up the info window (alternatively right-click the app then select ‘get info’).
- In the resulting pop-up, click on the icon at the top to highlight it like so (notice the blue halo around it):
- Then use cmd+v to paste the new icon from the clopboard into the icon area and it should look like this:
- Close the info window, and it’s done. You should now have a nice looking shortcut that opens Chrome Incognito with one or two clicks!