Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

CodFos

macrumors newbie
Original poster
Jul 26, 2011
10
0
Centennial CO
No matter what command I use or anything I always get a "-bash: (command): command not found" is there any fix? I have already tried reinstalling OSX.
 
You will likely need to add a few things to your PATH variable :
./
/bin
/usr/bin
/usr/sbin
/usr/local/bin

This is were 99% of the unix commands and applications reside. NOTE: this is just a list, use a command like this

set PATH=./:/bin:/usr/bin:/usr/sbin:/usr/local/bin/:$PATH$
or
export PATH=./:/bin:/usr/bin:/usr/sbin:/usr/local/bin/:$PATH$

To see your current PATH variable, use

echo $PATH$
 
What commands are you using? It's hard to say without more information.

I tried a "defaults write com.apple.dock no-glass -boolean YES" command and it comes back with "-bash: defaults: command not found"

----------

You will likely need to add a few things to your PATH variable :
./
/bin
/usr/bin
/usr/sbin
/usr/local/bin

This is were 99% of the unix commands and applications reside. NOTE: this is just a list, use a command like this

set PATH=./:/bin:/usr/bin:/usr/sbin:/usr/local/bin/:$PATH$
or
export PATH=./:/bin:/usr/bin:/usr/sbin:/usr/local/bin/:$PATH$

To see your current PATH variable, use

echo $PATH$

I tried the set path command and it didn't change my echo path. When I did the export path it set the path to

./:/bin:/usr/bin:/usr/sbin:/usr/local/bin/::/Users/codyfoster/Documents/android-sdk-mac/tools$$

Is there any way to just reset it to default? I was messing with the Android SDK and I think that is where it went wrong.
 
Just a guess, but your .bashrc or .profile got the android stuff put into it. You could try editing those files to see how your path gets set. Plus you could put the export line you typed into the appropriate file so your path is always set properly.

BTW, that looks like a decent path, at least to start from. If it were me, I'd make sure that you had that export line in your .bashrc file. You can add to it as necessary.

If you're having trouble, post the contents of your .bashrc and .profile files along with the errors you're getting.
 
I tried a "defaults write com.apple.dock no-glass -boolean YES"

try

/usr/bin/defaults write com.apple.dock no-glass -boolean YES

likely you messed up your shell settings doing something you did not understand

edit: I have no idea what that command does, so proceed with caution!
 
Just a guess, but your .bashrc or .profile got the android stuff put into it. You could try editing those files to see how your path gets set. Plus you could put the export line you typed into the appropriate file so your path is always set properly.

BTW, that looks like a decent path, at least to start from. If it were me, I'd make sure that you had that export line in your .bashrc file. You can add to it as necessary.

If you're having trouble, post the contents of your .bashrc and .profile files along with the errors you're getting.

Where do I find said .bashrc and .profile files.

Also being the brainless sack of meat I am, I deleted the plist for terminal and killed it. It wouldn't work at all so I reinstalled lion which fixed that, but now when I type echo $path$ all that comes up with is a $ and commands wont work either.

I guess I should also add that the Android SDK was installed long ago so that file isn't even in my documents anymore that it used to point to.

Thanks for the help guys, I usually am pretty good with figuring all this on my own but this time it is just killing me.
 
Appears your /etc/profile and /etc/bashrc are missing. Pasting the contents of both files below. Hope it helps. (both files are root owned and permissions 444)

Contents of /etc/bashrc
Code:
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
   return
fi

PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Tell the terminal about the working directory at each prompt.
if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then
    update_terminal_cwd() {
        # Identify the directory using a "file:" scheme URL,
        # including the host name to disambiguate local vs.
        # remote connections. Percent-escape spaces.
	local SEARCH=' '
	local REPLACE='%20'
	local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
	printf '\e]7;%s\a' "$PWD_URL"
    }
    PROMPT_COMMAND="update_terminal_cwd; $PROMPT_COMMAND"
fi

Contents of /etc/profile
Code:
# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
	eval `/usr/libexec/path_helper -s`
fi

if [ "${BASH-no}" != "no" ]; then
	[ -r /etc/bashrc ] && . /etc/bashrc
fi

Hopefully you have the /usr/libexec/path_helper file. If not, let me know and I will upload or email it.
 
Appears your /etc/profile and /etc/bashrc are missing. Pasting the contents of both files below. Hope it helps. (both files are root owned and permissions 444)

Contents of /etc/bashrc
Code:
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
   return
fi

PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Tell the terminal about the working directory at each prompt.
if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then
    update_terminal_cwd() {
        # Identify the directory using a "file:" scheme URL,
        # including the host name to disambiguate local vs.
        # remote connections. Percent-escape spaces.
	local SEARCH=' '
	local REPLACE='%20'
	local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
	printf '\e]7;%s\a' "$PWD_URL"
    }
    PROMPT_COMMAND="update_terminal_cwd; $PROMPT_COMMAND"
fi

Contents of /etc/profile
Code:
# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
	eval `/usr/libexec/path_helper -s`
fi

if [ "${BASH-no}" != "no" ]; then
	[ -r /etc/bashrc ] && . /etc/bashrc
fi

Hopefully you have the /usr/libexec/path_helper file. If not, let me know and I will upload or email it.

So I checked both of those files and they are complete and containing those codes exact.

I did also have the path_helper file. When I ran $ /usr/libexec/path_helper I got?

PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/codyfoster/Documents/android-sdk-mac/tools"; export PATH;

Anything more? Did I screw the pooch? When I try to set the path, nothing happens, I hit enter and it just drops back like I never entered anything. I typed in

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

and now when I type echo $bash$ nothing but a $ shows up again.
 
So I checked both of those files and they are complete and containing those codes exact.

I did also have the path_helper file. When I ran $ /usr/libexec/path_helper I got?

PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/codyfoster/Documents/android-sdk-mac/tools"; export PATH;

Anything more? Did I screw the pooch? When I try to set the path, nothing happens, I hit enter and it just drops back like I never entered anything. I typed in

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

and now when I type echo $bash$ nothing but a $ shows up again.

I am having the EXACT same problem, with Android SDK as well. My phone is semi-bricked, I figured to fix that using ADB connection and failed, making the terminal to just not work at all. I am currently reading everywhere about this problem and still don't have any clue on how to fix it...
 
I am having the EXACT same problem, with Android SDK as well. My phone is semi-bricked, I figured to fix that using ADB connection and failed, making the terminal to just not work at all. I am currently reading everywhere about this problem and still don't have any clue on how to fix it...

Create another user account, enable fast user switching. Switch to other user account. Open Terminal and try any command for example ls. If it works copy .bashrc and/or .profile from the working user account to the home folder of the one that's not working. Change ownership of the files! Those files are hidden by default so you can use this applescript to make them visible in Finder.

Code:
display dialog "Show or hide files in Finder?" buttons {"Cancel", "hideFiles", "showFiles"} default button 3
if the button returned of the result is "showFiles" then
	-- action for 1st button goes here
	do shell script "defaults write com.apple.finder AppleShowAllFiles YES; killall Finder"
else
	-- action for 2nd button goes here
	do shell script "defaults write com.apple.finder AppleShowAllFiles NO; killall Finder"
end if

To change ownership of the files you can use a full path to the command your trying like :

Code:
/usr/sbin/chown

Note : In case the the do shell script line doesn't work because of the messed up PATH you can use :

Code:
do shell script "/usr/bin/defaults write com.apple.finder AppleShowAllFiles YES; killall Finder"
 
Note : In case the the do shell script line doesn't work because of the messed up PATH you can use :

Code:
do shell script "/usr/bin/defaults write com.apple.finder AppleShowAllFiles YES; killall Finder"

It was actually a problem of the PATH. Something messed it up, now I fixed it... If someone has the same problem you can check the PATH following the command
Code:
echo $PATH
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.