I was following a tutorial trying to install Laravel (5.0). The tutorial showed to add export PATH="~/.composer/vendor/bin/laravel" to the .bash_profile document. Since then, I am not able to execute any command (nano, ssh, etc).

Nothing happens when I executed this in terminal:

export PATH="~/.composer/vendor/bin/laravel"

My .bash_profile looks like this:

export PATH=/Applications/MAMP/bin/php/php5.5.10/bin:$PATH

I tried logging out, restarting and entering the following commands:

source ~/.bash_profile
. .bash_profile

Can anyone help?

2 Answers 2


When you did:

export PATH="~/.composer/vendor/bin/laravel"

You changed the system default PATH to something nearly useless. You should never replace PATH, you should only append to PATH.

Remove the following two lines from your ~/.bash_profile:

export PATH=/Applications/MAMP/bin/php/php5.5.10/bin:$PATH
export PATH="~/.composer/vendor/bin/laravel"

And replace them with the following:

pathadd() {
    if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
pathadd /Applications/MAMP/bin/php/php5.5.10/bin
pathadd ~/.composer/vendor/bin/laravel
export PATH

This is a safe way to append to your PATH environment variable. It only does the append if the path isn't already in the list.

  • I did as you suggested however, I am still not able to use nano or SSH commands. Jan 1, 2015 at 21:23
  • You have to quit existing shell sessions and start new ones. Or run: source ~/.bash_profile.
    – Ian C.
    Jan 1, 2015 at 21:23
  • Ah ha! I had to quit Terminal after using source ~/.bash_profile. Now everything works. Thank you! Jan 1, 2015 at 21:26
  • Why bother having pathadd? Just do like Lukas Bestle said.
    – user88236
    Jan 1, 2015 at 22:16
  • Lukas' answer is dangerous if you end up in a situation where you have sub-shells that re-read your .bash_profile -- you get overlong PATH env vars and that can be both problematic for predictable executable locations and for path searching speed.
    – Ian C.
    Jan 1, 2015 at 22:21

What you did is to overwrite the PATH variable. This removed every other path that was in your PATH before from the variable.

You need to do the following:

export PATH="$HOME/.composer/vendor/bin:$PATH"

This adds the Composer bin path to the system paths where SSH etc. are located.

  • ~ won't be expanded to the user's home folder if it's in quotes (even double-quotes). Either use export PATH=~/".composer/vendor/bin/laravel:$PATH", or export PATH="$HOME/.composer/vendor/bin/laravel:$PATH" Jan 4, 2015 at 8:26

You must log in to answer this question.

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