How can I launch Chrome with flags from command line more concisely?

smuggledPancakes picture smuggledPancakes · Oct 30, 2012 · Viewed 53.2k times · Source

I am developing a WebGL driven application and I want to launch chrome like this from the command line:

open -a Google\ Chrome --args --disable-web-security

I just don't want to have to type that in every single time. Is there a way to easily turn that into a one word command? I am using a mac if it matters.

Answer

Kevin Suttle picture Kevin Suttle · Nov 3, 2012

Just make an alias in your .bashrc or .bash_profile

alias ogc='open -a Google\ Chrome --args --disable-web-security'

And then reload your shell.

exec $SHELL

Now, every time you type ogc (or whatever you want to call it) in your terminal, it will run the full command open -a Google\ Chrome --args --disable-web-security