MacOS – Cannot open Terminal normally

bashmacosterminal

I tried to install opencv via homebrew, but I have done something wrong. I closed Terminal to restart it, however since then I can't open Terminal normally.

 Last login: Wed Sep 20 23:23:15 on ttys001
-bash: /usr/local/bin/virtualenvwrapper.sh: No such file or directory
-bash: touch: command not found
Ys-MacBook-Air:~ hareentej22$ nano ~/.bash_profile
-bash: nano: command not found
Ys-MacBook-Air:~ hareentej22$ ls
-bash: ls: command not found
Ys-MacBook-Air:~ hareentej22$ cd ..
Ys-MacBook-Air:Users hareentej22$ cd ..
Ys-MacBook-Air:/ hareentej22$ ls
-bash: ls: command not found
Ys-MacBook-Air:/ hareentej22$ source ~/.bash_profile
-bash: /usr/local/bin/virtualenvwrapper.sh: No such file or directory
Ys-MacBook-Air:/ hareentej22$ nano ~/.bash_profile
-bash: nano: command not found
Ys-MacBook-Air:/ hareentej22$ xcode --version
-bash: xcode: command not found
Ys-MacBook-Air:/ hareentej22$ brew doctor
-bash: brew: command not found
Ys-MacBook-Air:/ hareentej22$ brew update
-bash: brew: command not found
Ys-MacBook-Air:/ hareentej22$ 

When I opened Terminal, I tried the above command lines, but none work. How can this be fixed?

edit : i run the command line as @allan mentioned and i get the following result .

Ys-MacBook-Air:~ hareentej22$ /bin/ls -la
total 120
drwxr-xr-x+  32 hareentej22  staff   1088 Sep 17 03:12 .
drwxr-xr-x    6 root         admin    204 Jul  9 10:43 ..
-r--------    1 hareentej22  staff      7 Jul  8 20:16 .CFUserTextEncoding
-rw-r--r--@   1 hareentej22  staff  16388 Sep 21 00:39 .DS_Store
drwxr-xr-x    3 hareentej22  staff    102 Jul 17 00:55 .Seagate
drwx------   72 hareentej22  staff   2448 Sep 20 23:24 .Trash
-rw-------    1 hareentej22  staff  11027 Sep 20 01:01 .bash_history
-rw-r--r--    1 hareentej22  staff    133 Sep 20 17:04 .bash_profile
-rw-r--r--    1 hareentej22  staff      1 Sep 16 20:49 .bash_profile-miniconda3.bak
drwx------  238 hareentej22  staff   8092 Sep 21 21:10 .bash_sessions
drwxr-xr-x    4 hareentej22  staff    136 Sep 16 20:55 .conda
drwxr-xr-x   10 hareentej22  staff    340 Aug 30 23:59 .eclipse
drwxr-xr-x    3 hareentej22  staff    102 Aug 17 00:28 .netbeans-derby
drwxr-xr-x    7 hareentej22  staff    238 Aug 17 00:30 .oracle_jre_usage
drwxr-xr-x    8 hareentej22  staff    272 Sep  5 19:11 .p2
-rw-r--r--    1 hareentej22  staff    243 Sep 11 16:41 .profile
drwxr-xr-x    5 hareentej22  staff    170 Sep 14 13:28 .pyenv
-rw-------    1 hareentej22  staff     12 Sep 14 13:30 .python_history
drwxr-xr-x    3 hareentej22  staff    102 Aug 30 23:48 .tooling
-rw-------    1 hareentej22  staff   6232 Sep 17 00:23 .viminfo
drwxr-xr-x   14 hareentej22  staff    476 Sep 17 03:13 .virtualenvs
drwx------@   3 hareentej22  staff    102 Jul  9 11:02 Applications
drwx------+  31 hareentej22  staff   1054 Sep 20 23:24 Desktop
drwx------+   6 hareentej22  staff    204 Sep 12 22:30 Documents
drwx------+  38 hareentej22  staff   1292 Sep 18 16:43 Downloads
drwx------@  71 hareentej22  staff   2414 Sep 17 00:07 Library
drwx------+   3 hareentej22  staff    102 Jul  8 20:16 Movies
drwx------+   4 hareentej22  staff    136 Jul  8 20:36 Music
drwxr-xr-x    2 hareentej22  staff     68 Jul 29 13:36 Parallels
drwx------+   6 hareentej22  staff    204 Jul  9 10:00 Pictures
drwxr-xr-x+   5 hareentej22  staff    170 Jul  8 20:16 Public
drwxr-xr-x    3 hareentej22  staff    102 Aug 30 23:35 eclipse


 Ys-MacBook-Air:~ hareentej22$ cat .bash_profile
-bash: cat: command not found
Ys-MacBook-Air:~ hareentej22$
Ys-MacBook-Air:~ hareentej22$ cat .bash_profile
-bash: cat: command not found
Ys-MacBook-Air:~ hareentej22$ /bin/cat .bash_profile
export PATH=”/usr/local/opt/python/libexec/bin:$PATH”

# Virtualenv/VirtualenvWrapper
source /usr/local/bin/virtualenvwrapper.sh

Best Answer

Edit your ~/.bash_profile with nano replacing username with your actual profile username.

$ /usr/bin/nano /Users/username/.bash_profile

Delete the line(s) containing your PATH statement. Save and exit. When you restart your Terminal session, your path should be back to normal.