Arif
Arif

Reputation: 369

Touch, open, ls not working on Mac 10.15.6 terminal, PATH issues

I have been trying to use touch, open and ls commands but this error is returned - -bash: open: command not found. It has always worked until today. This started happening after I added the Postgres path to PATH. Additionally, my PATH looks quite messy and I have absolutely no understanding of that.

Note - I have been through various solutions here on PATH and bash command not found but none seem to be working. Another thing is I can’t use stuff like sudo. I am adding my .bash_profile here if it helps -

# >>> conda initialize >>>
# !! Contents within this block are managed by ‘conda init’ !!

# Setting PATH for Python 3.8
# The original version is saved in .bash_profile.pysave
PATH=“${PATH}”
PATH=/bin:/usr/bin:/sbin:/usr/sbin
export PATH
export PATH = /Users/arif/Library/Python/2.7/bin
export PATH = /Users/arif/Library/Python/2.7/bin:$PATH
echo “source /usr/local/bin/virtualenvwrapper.sh” >> ~/.bash_profilesource /usr/local/bin/virtualenvwrapper.sh
export PATH=/usr/local/opt/ruby/bin:$PATH


# Setting PATH for Python 3.8
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
export PATH

export PATH=/Applications/Postgres.app/Contents/Versions/latest/bin(ScrapProj) Arifs-MacBook-Air:scraper_app arif$ python3

Please help me fix this, Thanks!

Upvotes: 0

Views: 384

Answers (1)

MarcoLucidi
MarcoLucidi

Reputation: 2177

the contents of your PATH gets overwritten because the "previous" PATH is not (always) added back when you put a new directory. that is why you end up with just Postgres bin directory at the end and the basic unix tools (ls, touch, etc..) cannot be found.

I tried to fix the issues in your .bash_profile:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!

# these should already be in the PATH, but re-adding them wont hurt...
export PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"

# add other directories to the PATH here remembering to append (previous) PATH at the end
PATH="/Users/arif/Library/Python/2.7/bin:$PATH"
PATH="/usr/local/opt/ruby/bin:$PATH"
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:$PATH"
PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"

echo “source /usr/local/bin/virtualenvwrapper.sh” >> ~/.bash_profilesource /usr/local/bin/virtualenvwrapper.sh

Upvotes: 1

Related Questions