How can I assign this alias to my new mac with Yosemite?

alias in = "npm install && bower install"

1 Answer 1


Add the alias directive to your ~/.bashrc file. You'll need to remove the spaces around the = symbol for bash to parse the command correctly:

alias in="npm install && bower install"

You could allow the caller to specify a package name if you use a shell function instead of an alias. Here we pass the same argument to both npm and bower (note, use "$@" instead of $1 if there is more than one argument):

in() {
    npm install $1 && bower install $1

Also see https://stackoverflow.com/questions/15364259/automating-npm-install-bower-install-dev-with-generator-angular-for-yeoma

  • do I have to shut all my terminal windows, or open new ones to use this? Commented Feb 16, 2015 at 10:49
  • source ~/.bashrc to take effect in an existing shell.
    – zackse
    Commented Feb 17, 2015 at 2:03
  • I have this: alias sd=“—save-dev” but in terminal I type sd I get:**-bash: sd: command not found** Commented Feb 18, 2015 at 17:37
  • 1
    A bash alias can only be used as a command, not an argument. To create a shortcut for a command-line option, you would need to use an alias that includes the option (e.g., alias sd='npm install --save-dev' or use an environment variable (export SD='--save-dev') and then issue npm install $SD which really doesn't save much typing.
    – zackse
    Commented Feb 18, 2015 at 18:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .