Process completed immediately after opening Terminal and impossible to add commands
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 :
- Go to Terminal icon on Dock, press right click and press New Command
/bin/bash -x
, and reopen Terminal (it shows your problem)- Go to Preferences → General and set Shells open with to Command, and enter the following:
/bin/sh
- Close the Terminal Preferences window
- Open Terminal again (it should work)
vi /Users/<your_user>/.bash_profile
, remove the lines found in step 2- Go to Preferences → General and set Shells open with to Command, and enter the following:
/bin/bash
- 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$
Solution 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.