First of all, the problems:

  • I'm not able to use both exported bash commands and default system bash commands at the same time
  • Some of the exported paths working on terminal but some of them not

Things I did:

I was adding exports to my .bash_profile but I got the problems, then I searched for solutions. Tried a couple of things. I'm not sure if I did something wrong or what.

  • Changed: Terminal -> Preferences -> Shells open with, then reverted to default
  • Deleted .bashrc and .bash_profile files then reverted them to the first state
  • Corrected the $PATH directory, did everything in this answer: https://superuser.com/a/498356

If I restart the terminal, default bash commands working but if I source the .bash_profile or .bashrc then some of the exports working some of not and the default bash command not working(e.g. open command not working).

How can I manage to get it to work simultaneously while all my additional bash commands working?

My .bash_profile:

export JAVA_HOME="/usr/lib/jvm/default-java"
export ANDROID_HOME=/Users/user/Library/Android/sdk
export PATH=/Users/user/Library/Android/sdk/platform-tools:$PATH
export PATH=/Users/user/Library/Android/sdk/tools:$PATH
export PATH=/Users/user/Library/Android/ndk-build:$PATH
export PATH=$PATH:~/Flutter/flutter/bin
export PATH="\$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"

Sorry, I'm searching for hours and there too many different kinds of questions, solutions, suggestions and it's hard to figure out what should I do exactly. Thanks in advance!

1 Answer 1


Remove the \ in front of $PATH in the last line and start a new shell

  • Thanks! Now everything is working, you saved my day! Such a mini mistake, I copied that line from the official website :/ Jan 21, 2019 at 16:52
  • 1
    @mathronaut Do you mean the instructions here? if so, the escape (backslash) is there in the docs because it's part of a here-document that's being appended to ~/.bash_profile, and the backslash will be removed as part of the here-document processing (it's needed to keep $PATH from expanding prematurely). There's a note that "You should remove the leading slash if you want to run the export command directly in a terminal", but it doesn't point out that the same thing applies if you're editing the file directly. Jan 21, 2019 at 23:35
  • @mathronaut P.s. if this solved your problem, you should mark it as the accepted answer. See What should I do when someone answers my question? Jan 21, 2019 at 23:56
  • @GordonDavisson yes it's solved my problem, thanks for all your help and great explanations! Jan 22, 2019 at 7:51

You must log in to answer this question.

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