11

This started when I was trying to install homebrew. I'm very new to all of this so I apologize in advance if I do not explain this with the correct vocabulary.

I initially ran brew doctor and got command not found. After scouring some forums and changing $PATH, I at least got to the point where brew doctor gave me a warning suggesting I remove part of $PATH. Unfortunately I can't remember exactly which part--something starting with "/opt."

I removed some of the $PATH but am now unable to run basic commands such as:

Tays-MacBook-Pro:~ taytufenkjian$ irb
-bash: irb: command not found
Tays-MacBook-Pro:~ taytufenkjian$ open ~/.bash_profile
-bash: open: command not found

Now my brew doctor attempts look like this:

Tays-MacBook-Pro:~ taytufenkjian$ brew doctor
/usr/local/bin/brew: line 2: dirname: command not found
/usr/local/bin/brew: line 5: basename: command not found
/usr/local/bin/brew: line 8: readlink: command not found
/usr/local/bin/brew: line 16: cd: /Users/taytufenkjian/../Library: No such file or directory
/usr/local/bin/brew: line 18: uname: command not found
/usr/local/bin/brew: line 18: tr: command not found
/usr/local/bin/brew: line 23: exec: ruby: not found

I thought I'd try to reset my $PATH but the commands I keep trying give me the "command not found" message.

$PATH details:

Tays-MacBook-Pro:~ taytufenkjian$ echo $PATH
/usr/local/bin:/usr/local/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/bin:/usr/local/bin:/Users/taytufenkjian/

I've been at this for a couple of hours and I'm so confused. I'm trying to set up my environment for a class that starts in a few days.

TayTuf
  • 151
  • 1
  • 1
  • 8

5 Answers5

20

It is happens when you just copy the line (below) into the .bash_profile without removing the quotes ('xxxx')

export PATH='/usr/local/bin:$PATH'

To resolve, just run in console:

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

Then, edit again the file removing the quotes:

vim ~/.bash_profile

4

I was actually able to get some outside help on this.

For other newbies reading this, I created a new .bash_profile and saved over the existing one.

I added this line to the .bash_profile: export PATH=/usr/local/bin:$PATH

So editing .bashrc didn't work but creating a new .bash_profile and editing that did work.

TayTuf
  • 151
  • 1
  • 1
  • 8
1

Your path should look something a little more like this:

/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin

In order to get this; you really shouldn't have to do much except this:

export PATH=/usr/local/bin:/usr/local/sbin:$PATH

Put that into your ~/.bashrc.

Start a new terminal session and try it out.

Wil Moore III
  • 6,968
  • 3
  • 36
  • 49
  • I don't seem to be able to edit .bashrc in the terminal or use the terminal to view hidden files, so I opened a text editor and saved over the .bashrc that was already there. I reopened the terminal but nothing seems to have changed. Basic commands like ls still aren't working. Posting the code separately because it's too long. – TayTuf Oct 17 '13 at 13:13
  • `Tays-MacBook-Pro:~ taytufenkjian$ echo $PATH /usr/local/bin:/usr/local/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/bin:/usr/local/bin:/Users/taytufenkjian/ Tays-MacBook-Pro:~ taytufenkjian$ export PATH=/usr/local/bin:/usr/local/sbin:$PATH Tays-MacBook-Pro:~ taytufenkjian$ echo $PATH /usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/local/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/bin:/usr/local/bin:/Users/taytufenkjian/` – TayTuf Oct 17 '13 at 13:16
  • `Tays-MacBook-Pro:~ taytufenkjian$ touch ~/.bashrc -bash: touch: command not found Tays-MacBook-Pro:~ taytufenkjian$ nano ~/.bashrc -bash: nano: command not found Tays-MacBook-Pro:~ taytufenkjian$ ls -a -bash: ls: command not found Tays-MacBook-Pro:~ taytufenkjian$` – TayTuf Oct 17 '13 at 13:18
0

I had to remove the quotes, but closing and re-launching my terminal is what ultimately confirmed the change had worked.

thehme
  • 2,698
  • 4
  • 33
  • 39
-1

I couldn't create new .barsh_profile or any other file starting with . using TextEdit. So, to restore terminal settings, I run '. /etc/profile'. After that I was able to run other commands, and create/remove/modify .* system files.

william.eyidi
  • 2,315
  • 4
  • 27
  • 39