0

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
14
  • 1
    Please post the contents of your ~/.bash_profile
    – Allan
    Commented Sep 20, 2017 at 18:17
  • 2
    I'd say the PATH environment variable is messed up! Commented Sep 20, 2017 at 18:18
  • @Allan export PATH=/usr/local/bin:$PATH . source /usr/local/bin/virtualenvwrapper.sh
    – hareen tej
    Commented Sep 20, 2017 at 18:44
  • @user3439894 i guess the same . but i just dont know how to fix .
    – hareen tej
    Commented Sep 20, 2017 at 18:48
  • 1
    You are using (RIGHT DOUBLE QUOTATION MARK Unicode: U+201D, UTF-8: E2 80 9D) instead of " (QUOTATION MARK Unicode: U+0022, UTF-8: 22) as quotation marks which will break the whole PATH.
    – klanomath
    Commented Sep 21, 2017 at 19:09

2 Answers 2

3

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.

4
  • i ran the above command line and entered into nano , but i see it is blank . sorry for the wrong information in my comment regarding the contents of ~/.bash_profile . And after exiting the nano and the problem still persists
    – hareen tej
    Commented Sep 20, 2017 at 19:11
  • sorry sir , ls command is'nt working which you can see in the 3rd line that i posted . but i ran it to check again ls -la and i got the following . Ys-MacBook-Air:/ hareentej22$ ls -la -bash: ls: command not found Ys-MacBook-Air:/ hareentej22$
    – hareen tej
    Commented Sep 20, 2017 at 19:25
  • 1
    Sorry...it should be /bin/ls -la from within your home directory.
    – Allan
    Commented Sep 20, 2017 at 19:33
  • what shall i do after running the above mentioned command line.
    – hareen tej
    Commented Sep 21, 2017 at 6:54
2

Your .bash_profile PATH definition is framed by the wrong quotation marks.

You have to use the quotation mark " instead of left double , right double or single ‘’ quotation marks or apostrophes '.

Open and edit the file by entering /usr/bin/nano $HOME/.bash_profile in Terminal.app and replacing with ". Hit ctrlO and ctrlX to save the modified file to disk, then close the Terminal window by entering exit. Relaunch Terminal to start a new session.

You must log in to answer this question.

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