None of the commands are working in my Terminal

I have Mac OS Catalina (version 10.15.7) and I observed that none of the commands are working in my terminal. Tried following commands:


$ java -version

-bash: java: command not found


$ touch ~.bash_profile

-bash: touch: command not found

Posted on Sep 8, 2021 10:57 PM

Reply
Question marked as Top-ranking reply

Posted on Sep 10, 2021 10:33 AM

A few corrections:


1) You don't need to export PATH multiple times. One is enough.


2) These commands are resetting PATH and annuling all the previous ones:


PATH=$ANDROID_HOME/build-tools

PATH=$ANDROID_HOME/platform-tools

PATH=$ANDROID_HOME/tools


You can do more than one at a time, but don't forget to concatenate with the previous value of PATH.

For example, these three could become


PATH=$ANDROID_HOME/build-tools:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$PATH


This adds these three directories at the head of the PATH.

If you omit the final :$PATH, then the previous value of PATH is discarded.



3) Same thing here, add :$PATH at the end


# Setting PATH for Appium

PATH="/usr/local/lib/node_modules/appium"

export PATH


PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

export PATH


4) These are duplicates, delete one of them.


# Setting PATH for Python 3.9

# The original version is saved in .bash_profile.pysave

PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}"

export PATH


# Setting PATH for Python 3.9

# The original version is saved in .bash_profile.pysave

PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}"

export PATH








18 replies

Sep 9, 2021 9:33 AM in response to rajiv212

What Bob Harris said about your PATH environment variable. If you are still using the Bash shell, then you want the PATH export statement in the $HOME/.bash_profile. If you switched to the zsh shell in Catalina, then it will not read your .bash_profile to get the PATH, and you need to create a $HOME/.zshrc file with the PATH statement in it.


In either case,


export PATH=".:/usr/local/bin:$PATH"


and after you have saved the dot file, you can make the PATH current by the respective shell:

source ~/.bash_profile
source ~/.zshrc


Afterward, your Java -version result will be useless until you have installed a current and compatible version of Java from Oracle. I would not recommend this unless you have an explicit purpose that requires Java.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

None of the commands are working in my Terminal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.