Terminal blank, .bash_profile broken

5,636

Solution 1

In your Terminal.app preferences, simply change your profile to run /bin/zsh by default (or any other shell you like except for Bash). Deactivate Run inside shell.

Now, start a new terminal window and remove your ~/.bash_profile:

rm ~/.bash_profile

Remove anything else you don't want, or change it with vim if you like. You can of course run the rm command right away from the Terminal startup.

You can start fresh from here. You don't need to source ~/.bashrc – you might never need this file on OS X anyway, as a new Terminal window runs a login shell and therefore sources .bash_profile.

You also don't need to have Homebrew binaries take precedence over system ones by changing your path. Homebrew has a strict policy of not supplying any duplicates of OS X software, so if you install – for example – GNU coreutils, you'll get gfind instead of find, etc.

Solution 2

Open up a text editor (I tried with Atom).

Save a blank text file as .bash_profile into your home directory.

Choose to Use "." when Mac alerts you that names that begin with "." are reserved for the system. Replace the old .bash_profile.

Share:
5,636

Related videos on Youtube

bash_profile blank
Author by

bash_profile blank

Updated on September 18, 2022

Comments

  • bash_profile blank
    bash_profile blank over 1 year

    I was following a tutorial for configuring OS X Mountain Lion and somehow after editing the bash_profile I can't run the terminal properly.

    The terminal starts just fine but is blank, if a wait long enough there's a "[Process complete]" that appears but that's all, I cannot run any command although I can still write.

    When I look at the Inspector I see that the process 'login' worked fine but for 'bash' it's another matter – its ID keeps going up with 'ruby'.

    This is the tutorial I was following.

    What I added to the .bash_profile before the problem showed up is:

    export ARCHFLAGS="-arch x86_64"
    export PATH=/usr/local/share/python:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
    test -f ~/.bashrc && source ~/.bashrc
    
    • HikeMike
      HikeMike almost 11 years
    • Admin
      Admin almost 11 years
      As the author of the linked article, I'm sorry to hear about the trouble the OP experienced. That said, I don't have any reason to suspect the steps in the tutorial as a probable cause of the described behavior. I've run those steps on fresh instances of Mountain Lion without any problems, as have many others following that tutorial. Regarding slhck's comment on changing the PATH... There are times when it is useful to utilize the homebrew-dupes repository, which is why Homebrew binaries take precedence on my systems.
  • bash_profile blank
    bash_profile blank almost 11 years
    I did change du the profile to run like in your screenshot, but when i start a new terminal window it's quite the same, i can type like it's a text editor and in the inspector the processes bash and ruby are going wild (their ID is going up up and up). So i cannot even remove the bash_profile with a command.
  • slhck
    slhck almost 11 years
    Can you run rm .bash_profile directly as a startup command?
  • bash_profile blank
    bash_profile blank almost 11 years
    What do you mean as a startup command ? When a ask for a new window i cannot do a thing, and when i type the command with "new command" it's printing : -rm: ~/.bash_profile: No such file or directory [Process completed]
  • slhck
    slhck almost 11 years
    I meant setting rm /Users/your-username/.bash_profile in the Run command field in your Terminal's preferences, instead of /bin/zsh.
  • bash_profile blank
    bash_profile blank almost 11 years
    same output : -rm: ~/.bash_profile: No such file or directory [Process completed]
  • slhck
    slhck almost 11 years
    Have you entered the full path to your .bash_profile? Anyway, if it's not there, that'd mean the file does not exist anymore and you should be able to start your shell normally. Simply deactivate the Run command option.
  • Boris Verkhovskiy
    Boris Verkhovskiy over 7 years
    A slightly faster way to do the first step is Cmd+Shift+N