Messed up Terminal

Discussion in 'Mac Basics and Help' started by Riverrun, Jan 25, 2013.

  1. macrumors regular

    Joined:
    Jul 11, 2007
    Location:
    ~
    #1
    Long story. Briefly: I have duplicates in the right-click menu and I wanted to set up a bash profile to get rid of them and messed up horribly. I would like to get terminal back to normal.
    There is no .bash_profile in my home folder - it was probably the fact that I neglected to create one in the first place that got me into this mess. Terminal now opens in the way shown in the attachment.

    Anyhow, I'm out of my dept and need some help.

    Where is the "Open With has been rebuilt, Finder will relaunch stored"?
    Where is the "chmod:fixow" command stored?

    Is it safe to edit the file, assuming that I find it in the first place? Any help would be appreciated.
     

    Attached Files:

  2. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #2
    Not sure if Terminal is usable enough, but please paste in

    Code:
    cd; ls -al
    and post the output. Just copy and paste, no screenshot needed.
     
  3. thread starter macrumors regular

    Joined:
    Jul 11, 2007
    Location:
    ~
    #3
    The output is as follows


    Last login: Fri Jan 25 19:57:14 on ttys000
    Open With has been rebuilt, Finder will relaunch
    chmod: fixow: No such file or directory
    Seans-Mac-mini:~ sean$ cd; ls -al
    total 120
    drwxr-xr-x+ 24 sean staff 816 25 Jan 19:10 .
    drwxr-xr-x 5 root admin 170 25 Jul 2012 ..
    -rw------- 1 sean staff 3 18 Apr 2012 .CFUserTextEncoding
    -rw-r--r--@ 1 sean staff 21508 25 Jan 20:21 .DS_Store
    drwx------ 5 sean staff 170 25 Jan 20:40 .Trash
    -rw------- 1 sean staff 19 25 Jan 14:25 .bash_history
    -rw-r--r-- 1 sean staff 265 23 Jan 15:07 .bash_profile
    -rw------- 1 sean staff 248 23 Jan 14:57 .bash_profile.save
    -rw------- 1 sean staff 248 23 Jan 15:00 .bash_profile.save.1
    -rw------- 1 sean staff 235 23 Jan 15:05 .bash_profile.save.2
    -rw------- 1 sean staff 265 23 Jan 15:09 .bash_profile.save.3
    drwxr-xr-x 6 sean staff 204 11 Oct 18:53 .dvdcss
    -rw------- 1 root staff 1024 25 Jan 2012 .rnd
    drwxr-xr-x 6 sean staff 204 27 Jan 2012 .subversion
    -rw------- 1 sean staff 679 30 Jul 14:57 .viminfo
    drwx------+ 4 sean staff 136 25 Jan 20:17 Desktop
    drwx------+ 16 sean staff 544 25 Jan 19:10 Documents
    drwx------+ 8 sean staff 272 25 Jan 20:17 Downloads
    drwx------@ 58 sean staff 1972 25 Jan 20:27 Library
    drwx------+ 6 sean staff 204 25 Jan 19:10 Movies
    drwx------+ 9 sean staff 306 25 Jan 19:10 Music
    drwx------+ 9 sean staff 306 25 Jan 19:10 Pictures
    drwxr-xr-x+ 5 sean staff 170 25 Jan 19:10 Public
    drwxr-xr-x+ 3 sean staff 102 25 Jan 19:10 Sites
    Seans-Mac-mini:~ sean$
     
  4. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #4
    OK, you have .bash_profile. To see what's there, paste

    Code:
    cat ~/.bash_profile
    into Terminal. Please post the output.
     
  5. thread starter macrumors regular

    Joined:
    Jul 11, 2007
    Location:
    ~
    #5
    Thanks for the help.


    Last login: Fri Jan 25 20:41:48 on ttys000
    Open With has been rebuilt, Finder will relaunch
    chmod: fixow: No such file or directory
    Seans-Mac-mini:~ sean$ cat ~/.bash_profile
    #!/bin/sh
    /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user;killall Finder;echo "Open With has been rebuilt, Finder will relaunch"
    chmod ugo+rwx fixow

    Seans-Mac-mini:~ sean$
     
  6. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #6
    OK, the problem is in here. Let me take a look and I'll get back to you.
     
  7. thread starter macrumors regular

    Joined:
    Jul 11, 2007
    Location:
    ~
  8. macrumors 65816

    Dweez

    Joined:
    Jun 13, 2011
    Location:
    Down by the river
    #8
    Move your .bash_profile out of the way and try again.
     
  9. thread starter macrumors regular

    Joined:
    Jul 11, 2007
    Location:
    ~
    #9
    Getting rid of the .bash_profile might do the trick.

    Would sudo rm .bash_profile work?
     
  10. macrumors demi-god

    ChristianJapan

    Joined:
    May 10, 2010
    Location:
    日本
    #10
    Maybe first rename it into .bash_profile.sar. Or. .bash_profile.fixtrouble.

    You might want to keep it for a while; just to be safe. Once all settled you still can delete that file later.
     
  11. thread starter macrumors regular

    Joined:
    Jul 11, 2007
    Location:
    ~
    #11
    I got it, folks. Thanks for the help. I deleted all four bash profiles and things are back to normal.
     
  12. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #12
    OK, here's what you want:

    In Terminal, enter

    Code:
    cd; cat > .bash_profile
    Then paste in the following long line:

    Code:
    alias fixow='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user;killall Finder;echo "Open With has been rebuilt, Finder will relaunch"'
    
    Then press return and then control-d.

    You should get a new command prompt.

    Then paste in

    Code:
    . .bash_profile
    Then to test, quit Terminal and restart it. The weird stuff should be gone. Then enter

    Code:
    fixow
    and you should have what you were trying to do.
     
  13. thread starter macrumors regular

    Joined:
    Jul 11, 2007
    Location:
    ~
    #13
    Thanks LPZ. The wierd stuff is gone and the fixow command works a treat.

    I found it simpler to edit the .bash_profile with TextyWrangler, saved it as bash_profile.txt, moved it into my home folder, removed the extension and put a . before the bash_profile.

    Works great and saves me a lot of trouble.
     
  14. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #14
    You're welcome. Be careful with Terminal!
     
  15. macrumors demi-god

    Shrink

    Joined:
    Feb 26, 2011
    Location:
    New England, USA
    #15
    Terminal is a deep dark scary place.

    Abandon hope, all ye who enter there...:eek:
     

    Attached Files:

Share This Page