Terminal issues

Discussion in 'Mac Apps and Mac App Store' started by CodFos, Jan 19, 2012.

  1. CodFos macrumors newbie

    Jul 26, 2011
    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.
  2. Macman45 macrumors G5


    Jul 29, 2011
    Somewhere Back In The Long Ago
    What commands are you using? It's hard to say without more information.
  3. CylonGlitch macrumors 68030


    Jul 7, 2009
    You will likely need to add a few things to your PATH variable :

    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$
    export PATH=./:/bin:/usr/bin:/usr/sbin:/usr/local/bin/:$PATH$

    To see your current PATH variable, use

    echo $PATH$
  4. CodFos thread starter macrumors newbie

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


    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


    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.
  5. willieva macrumors 6502

    Mar 12, 2010
    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.
  6. dknightd macrumors 6502

    Mar 7, 2004

    /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!
  7. CodFos thread starter macrumors newbie

    Jul 26, 2011
    Centennial CO
    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.
  8. whiteonline macrumors 6502


    Aug 19, 2011
    California, USA
    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
    # System-wide .bashrc file for interactive bash(1) shells.
    if [ -z "$PS1" ]; then
    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"
    Contents of /etc/profile
    # System-wide .profile for sh(1)
    if [ -x /usr/libexec/path_helper ]; then
    	eval `/usr/libexec/path_helper -s`
    if [ "${BASH-no}" != "no" ]; then
    	[ -r /etc/bashrc ] && . /etc/bashrc
    Hopefully you have the /usr/libexec/path_helper file. If not, let me know and I will upload or email it.
  9. CodFos thread starter macrumors newbie

    Jul 26, 2011
    Centennial CO
    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.
  10. StahliCell macrumors newbie

    Jun 9, 2014
    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...
  11. kryten2 macrumors 6502a

    Mar 17, 2012
    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.

    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"
    	-- 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 :

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

    do shell script "/usr/bin/defaults write com.apple.finder AppleShowAllFiles YES; killall Finder"
  12. StahliCell macrumors newbie

    Jun 9, 2014
    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
    echo $PATH

Share This Page