terminal is messed up

G

germpest

Guest
I am trying to learn the terminal and for some reason basic commands don't work. I am trying "ls" and it says bash: ls :command not found. Although yesterday this was working fine. Is there a way to reinstall the terminal?
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
It's not the terminal, it's your path, or lack thereof. What do you get when you type:
echo $PATH
 
OP
G

germpest

Guest
cradom said:
It's not the terminal, it's your path, or lack thereof. What do you get when you type:
echo $PATH

/opt/local/bin:/opt/local/sbin:{ PATH} :/usr/local/bin
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
Hmmm...looks like something is messed up. Check your .bashrc or .bash_profile file for syntax errors. Probably where it says { PATH}. Should look like this: ${PATH}.
 
OP
G

germpest

Guest
cradom said:
Hmmm...looks like something is messed up. Check your .bashrc or .bash_profile file for syntax errors. Probably where it says { PATH}. Should look like this: ${PATH}.
where is that located? /etc/? I can't even su to root.
 

rman


Retired Staff
Joined
Dec 24, 2002
Messages
12,637
Reaction score
168
Points
63
Location
Los Angeles, California
Your Mac's Specs
14in MacBook Pro M1 Max 32GB 2TB
In your home directory/folder.
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
What rman said. You can open a terminal and type:
/bin/ls -a
to see if it's there. If you're not familiar with the pico editor or vi, you can open it and edit it with Textwrangler (free) from the Finder. Use the 'open hidden' menu item.

From what your $PATH shows, you might have DarwinPorts installed? Normally there is no /opt directory in OS X, and nothing in /usr/local/bin.
 
OP
G

germpest

Guest
cradom said:
What rman said. You can open a terminal and type:
/bin/ls -a
to see if it's there. If you're not familiar with the pico editor or vi, you can open it and edit it with Textwrangler (free) from the Finder. Use the 'open hidden' menu item.

From what your $PATH shows, you might have DarwinPorts installed? Normally there is no /opt directory in OS X, and nothing in /usr/local/bin.

It's funny, all this trouble started when I was trying to install blackbox window manager. Something told me to install DarwinPorts and I didn't do that right. Then something else told me to change my bash_profile file and add a line to it. I screwed up the line...

Anyways, bash_profile isn't under my home directory.

"Edit either /etc/profile or ~/.bash_profile and add the following line at the end. You will need to re-login for the changes to take effect."

this is what I tried to follow.
 
OP
G

germpest

Guest
thanks

I finally figured it out
it was etc/profile, and I had $P{PATH} instead of ${PATH}

thanks for all your help. this was a bit frustrating.
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
Actually, it's not a good idea to edit etc/profile because whatever is changed there will be global. It will affect all users on the machine, not just your account. If you screw up and create a new user to find the problem, you will have the same problem in the new user.

It's better to copy the file to your home folder or create a new one in your home folder so it just affects your account.
 

rman


Retired Staff
Joined
Dec 24, 2002
Messages
12,637
Reaction score
168
Points
63
Location
Los Angeles, California
Your Mac's Specs
14in MacBook Pro M1 Max 32GB 2TB
Like cradom suggested it is better to make change to you personal copy and not the system copy.
 
OP
L

Logan

Guest
Sort of off topic but I wanted to mention anyways, iTerm is a handy free download for those of you who want a little bit more out of your Terminal.

and for no particular reason: I love pico. vi makes me cry.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top