basic terminal commands not working

Joined
Jul 25, 2011
Messages
7
Reaction score
0
Points
1
Hi, I hope this is the right section for this question. We can't get basic Terminal commands to work on a new mac mini, and AppleCare won't support Terminal issues.

We are on OSX 10.6.4. Opening a terminal window, we see "(user)'s-Mac-mini:~ (user)$"

If I type "ls", some of the obvious basics are listed, like Desktop and Documents. If I type "cd Desktop", I get "~bash: cd desktop: command not found".

Similar questions online seemed to point to an issue with the PATH variable, so I type "echo $PATH" and get the following...

"~bash: /bin/echo /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin: No such file or directory"

I get the same by typing "/bin/echo $PATH". If I type "help", "cd" is listed in the list, but if I type "help cd", I get "command not found".

We have tried reformatting the drive and reinstalling the OS from the disk. This is a brand new mac mini. All we did before discovering this problem was try to install MySQL, but I would imagine a full reformat would eliminate any damage that might've caused. AppleCare refuses to cover any terminal-related issues, but they did walk us through the process of reformating the drive to make sure we were doing a COMPLETE clean reinstall back to factory defaults.

Also, we have another mac mini (10.5.something) that all of these commands work fine on.

Any other suggestions?

EDIT: I also tried going into Terminal Preferences and changing "Shell open with:" from Default (/usr/bin/login) to Command (/bin/bash)
 
Joined
Feb 26, 2010
Messages
2,116
Reaction score
123
Points
63
Location
Rocky Mountain High, Colorado
Your Mac's Specs
1.8 GHz i7 MBA 11" OSX 10.8.2
You could try hard coding the path and seeing if the commands come back - looks like you are using bash.

Code:
unset PATH
export PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

See if /usr/bin/env looks like it shows anything funky.
 
OP
E
Joined
Jul 25, 2011
Messages
7
Reaction score
0
Points
1
Thanks for the quick reply! I get the following...

Code:
(user)s-Mac-mini:~ (user)$ unset PATH
-bash: unset PATH: command not found
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
Did you clean up the hard drive recently?
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
You mention that both "cd" and "unset" were not found and since both are builtins, I'm wondering if perhaps the issue is bash itself (ie. bash is broken). If you open up Terminal, can you launch another shell like csh (/bin/csh) or ksh (/bin/ksh)? If so, can you use any builtins there?
 
OP
E
Joined
Jul 25, 2011
Messages
7
Reaction score
0
Points
1
@vansmith

I tried changing the terminal settings to start up as /bin/sh instead of /bin/bash, but when I opened terminal from the dock after restart, it was still bash. That may have just been because the dock's terminal icon was still linked to bash (I'm slightly new to macs, so not sure of all the in's and out's). Currently we are doing a second reformat (this time re-partitioning the drive) so I can't test further.
 
OP
E
Joined
Jul 25, 2011
Messages
7
Reaction score
0
Points
1
Still no luck after a full re-partition / reformat / reinstall from installation disk.

@vansmith - I open terminal (bash), and type "sh" and hit enter and get switched to a prompt that begins with "sh-3.2$". Is that all I need to do to switch from bash to sh? If so, I still get "command not found" on most of the basics (excluding ls).
 
OP
E
Joined
Jul 25, 2011
Messages
7
Reaction score
0
Points
1
This might be more useful information. If I enter any command withOUT parameters, the command runs (whether or not it does anything). But if I add parameters to anything, that's when I get "command not found". For instance, I noted earlier that "ls" runs, but I just discovered it does NOT run if I do "ls -a". So it would appear my real problem involves parameters.
 
OP
E
Joined
Jul 25, 2011
Messages
7
Reaction score
0
Points
1
SOLVED!!!

This will sound absolutely rediculous, but we switched out the third-party (Dell) USB keyboard with a mac keyboard, and everything works! This blows my mind. I guess maybe the foreign keyboard was causing terminal to use some kind of "special space character" instead of a true space??
 
Joined
Feb 26, 2010
Messages
2,116
Reaction score
123
Points
63
Location
Rocky Mountain High, Colorado
Your Mac's Specs
1.8 GHz i7 MBA 11" OSX 10.8.2
Thanks for the update. If you want to check your theory there is an app store app that shows the key codes of key presses.
Key Codes on the Mac App Store
Do you have the model number of the "bad" keyboard?
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
I won't lie - this is the one of the oddest problems I've ever seen when it comes to using Bash. I'm glad you found a fix and thanks for posting back with the solution!
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
Hrm, I've seen this when pasting from one formatted type of text to a terminal (mostly from rich text, office, etc) to terminal. Never from a 'board though. interesting.
 

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