4

Recently I got tired of the smaller kinks that the Fish Shell presented me with (undiscoverable commands etc.) so I decided I wanted to change the shell back to normal and uninstall fish.

However in the process of doing so I have done something terribly wrong.

I have set it to the normal: /bin/bash

However Im represented with a series of prompts (in regards to Vagrant) and have to exit this with the CTRL+C command (cancel)

I want to get my old terminal back (with my current folder prepended etc.) but I have no clue in how to accomplish this.

I've attached two screenshots. One is the current terminal (the one with the bash -bash-3.2$in front. The second is the terminal i want (the default with username appended) [source of image is found on the internet, for reference]

This is the terminal I have The Terminal I have

This is the terminal I want The Terminal I want

I've found two things:

  1. My bash profile is deleted hence i cannot see my computer name etc. I've tried to recreate it but:
  2. I need a sample .bash_profile
  3. ...and i need it to be persistent such that when i exit my terminal I do not fire the VVV script (that it apparently fires off when it first enters the terminal)
2
  • 1
    What do you have in ~/.bashrc ~/.bash_profile ~/.profile etc
    – mmmmmm
    Commented Aug 18, 2014 at 12:33
  • None these are completely blank. I deleted everything... and changed the shell Commented Aug 18, 2014 at 13:58

4 Answers 4

2

First, rm ~/.bashrc ~/.bash_profile ~/.profile These are not needed and don't exist by default.

Second, check to see /etc/profile is there, should be:

# 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

Third, check /etc/bashrc (this is where your prompt is defined). Should be:

# 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

Finally, if it's still not working make sure you have /bin/bash set as your default shell using the advanced options in the User & Groups System Preference. If you don't login with bash, it will bypass the configs in /etc/

1
  • With minor modifications (namely removing the backward slashes, the code (in the /etc/bashrc - file) worked! Apparently I faulty placed the code for the VVV generation script inside of my /etc/bashrc Everything is fixed now. Thanks dear poster. Commented Aug 19, 2014 at 7:48
4

The simplest way to get back your default .bash_profile might be to just create a new user on your Mac. Log in and copy the desired files to that user's shared/public folder. Then log in as you and copy them to the root of your profile folder.

The added bonus of this is that you now have a virgin, virtually untouched, user that you can use when troubleshooting your Mac. Unless you are short of disk space a new user profile is not that big and can be valuable in troubleshooting.

1
  • This shell account could also be used to compare the dot files in both home directories. From that it might be quite easy to sort out the default contents of .bashrc .profile etc...
    – bmike
    Commented Aug 18, 2014 at 16:39
1

This is the last chapter in the Fish Shell Documentation:

Should you wish to uninstall fish, first ensure fish is not set as your shell. Run

chsh -s /bin/bash

if you are not sure.

Next, do the following (assuming fish was installed to /usr/local):

sudo rm -Rf /usr/local/etc/fish /usr/local/share/fish ~/.config/fish
sudo rm /usr/local/share/man/man1/fish*.1
cd /usr/local/bin
sudo rm -f fish mimedb fish_pager fishd fish_indent
2
  • Yes but the OP has done this - the issue is with his bash setup
    – mmmmmm
    Commented Aug 18, 2014 at 13:29
  • As said by Mark, I have uninstalled Fish and changed into /bin/bash shell, however I cannot see my username appended nor the folder Im currently in, within my terminal window Commented Aug 18, 2014 at 14:12
0

Clarification: There are two default shell settings.

  • One is the Unix setting and can be changed with chsh -s.
  • The other is the Terminal.app-specific setting, and can be changed in Terminal preferences.

You can set your Terminal default shell command to /bin/bash -l in the Terminal app.

screenshot

-l tells Bash to read startup files. Even if you don't have any user-specific startup files, there are system-wide startup files that will, among other things, set the prompt to the one you're familiar with.

If you've properly set your Unix default shell, you should be able to select Default login shell in Terminal preferences and this will happen automatically.

1
  • Its important to note that these settings should only be done within the Terminal App. However it is REALLY good advice to use this setting, and Im considering making it my default. Commented Aug 19, 2014 at 7:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .