1

Since I have made some changes on my .bash_profile document, when I open my terminal I got this message and I cannot add any command :

Last login: Thu Dec 19 10:02:58 on ttys000

[Process completed]

After trying many things like changing back my bash_profile to what it used to be but nothing worked. I spent a whole day on it. I followed this from https://apple.stackexchange.com/a/296871/313842 :

  1. Go to Terminal icon on Dock, press right click and press New Command
  2. /bin/bash -x , and reopen Terminal (it shows your problem)
  3. Go to Preferences → General and set Shells open with to Command, and enter the following: /bin/sh
  4. Close the Terminal Preferences window
  5. Open Terminal again (it should work)
  6. vi /Users/<your_user>/.bash_profile, remove the lines found in step 2
  7. Go to Preferences → General and set Shells open with to Command, and enter the following: /bin/bash
  8. Open Terminal, it should work now

Current issue : When I try step 6, I do not find the 2 lines and if I set Shells back to /bin/bash, it shows the original error again :

Last login: Thu Dec 19 10:10:32 on ttys000

[Process completed]

Here is the content of .bash_profile:

# Enable tab completion
source ~/git-completion.bash

# colors!
green="\[\033[0;32m\]"
blue="\[\033[0;34m\]"
purple="\[\033[0;35m\]"
reset="\[\033[0m\]"

# Change command prompt
source ~/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
# '\u' adds the name of the current user to the prompt
# '\$(__git_ps1)' adds git-related stuff
# '\W' adds the name of the current directory
export PS1="$purple\u$green\$(__git_ps1)$blue \W $ $reset"

You can find the content of the sourced files on these links: - git-completion.bash : https://pastebin.com/Y1X6FdNW - git-prompt.sh : https://pastebin.com/zt2pyLce

After bash -l :

MacBook-Pro-de-apple:~ apple$ bash -l
Segmentation fault: 11
MacBook-Pro-de-apple:~ apple$ 
  • What is the problem shown in step 2? Which two lines do you miss in step 6? – nohillside Dec 19 '19 at 10:49
  • Hi @nohillside, it actually didn't show anything for me on step 2. The instructions I found on that link (apple.stackexchange.com/questions/153408/…) said that I would have to delete the lines found on step 2 but I can't find them... – Lamia Dec 19 '19 at 13:35
  • @klanomath I realized my bash_profile content is already in my question. Could you help me with that? – Lamia Dec 19 '19 at 13:38
  • 1
    These are two huge files, uhh. To narrow it down, can you please add # in front of both of the source lines in your .bash_profile and repeat step 7 & 8. If it works, remove it from one of the lines again and repeat 7/8. Goal is to figure out which of the source commands triggers the problem. – nohillside Dec 19 '19 at 14:47
1

Problem fixed after following this:

1. Go to Terminal Preferences > Open Shells with : enter "/bin/bash -x"
2. On the terminal : sudo nano .bash_profile 
3. Delete the whole content of the bash_profile, then Ctrl + X (exit) Yes, Enter
4. Go to Terminal Preferences > Open Shells with : enter "/bin/bash"

someone guided me to that. For some reason, my .bash_profile was kind of doing a loop... Apparently, I also had another bash_profile document somewhere else... I won't be able to give more details for now as the person left but I will add more info here once I got them. Hope this will help others.

Thanks a lot to @nohillside and @klanomath for your help!! I appreciate a lot.

| improve this answer | |

You must log in to answer this question.

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