Create a Shortcut for Chrome on a Mac

To avoid CORs errors you can create your own shortcut

You might be developing and want to always open Chrome on your Mac with web security disabled.

To do so, just use Automator which manages to help you out and make things just that bit easier when you are developing.

Image for post
Image for post
Photo by Erwan Hesry on Unsplash

Difficulty: Beginner | Easy | Normal | Challenging

Terminology

Automator: An application that can help you automate tasks on your Mac

Spotlight: A way of finding files and applications on a Mac

Terminal: A command line interface to control the UNIX-based operating system that underlies the Mac

Opening Chrome with no web-security

The alternative

Now every-time you want to create an instance of Chrome by typing the following into Terminal

open -a Google\ Chrome --args --disable-web-security --user-data-dir

But we don’t want to type this in every time…therefore…

The automator

Now we’re talking. Open up spotlight by pressing Command — Space and type Automator.

Image for post
Image for post

As you might expect, Spotlight appears on the screen.

A response to the first Window is to press New Document

Image for post
Image for post

We can then choose Application

Image for post
Image for post

Now find Run Shell Script from the list of objects.

Image for post
Image for post

A quick double-click (or drag) makes the main area of Automator come alive!

Image for post
Image for post

We can then add the following script

open -n -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --user-data-dir=/tmp/chrome_dev_test --disable-web-security

in the main part of the screen

Image for post
Image for post

When you click run Chrome opens informing you that Web security is turned off.

Image for post
Image for post

Great! But we want this to be reusable so we can create a new icon.

So we save with ⌘S.

Image for post
Image for post

I called mine “ChromeNoSecurity” as you see.

But I’d like to have a more…appropriate icon.

We can right-click on the icon and select Get Info:

Image for post
Image for post

You can now put your own picture icon on top of the existing icon at the top-left hand corner of the window

Image for post
Image for post

And… we’re done!

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

Conclusion:

When you want to use a version of Chrome without web security you are likely to want to open it many times.

Rather than copying and pasting a long string of characters, instead you can follow the instructions above, and save some time.

Go on! You know you want to!

The Twitter contact:

Any questions? You can get in touch with me here

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store