How can I fix my terminal when editing the PATH in .bash_profile has the startup hang and I get no prompt?












4















I am new to the command line and clearly messed up my setup.




  • macOS High Sierra(10.13.6)

  • Trying to set up Python and VScode.


My path variable is what I believe is wrong, but Idon't know exactly how to get a shell and fix things.



It is now showing the user name when i go into terminal. After trying everything i tried to follow. https://shellzero.wordpress.com/tag/reset-path-on-mac/
My Terminal now looks like thisTerminal



My bash profile currently looks like this when i enter open .bash_profile in new command on terminalbash_profile text file



according to the suggestion of the article mentioned above, after entering export PATH=/usr/bin:/usr/sbin:/bin:/sbin and save the text file by command+S
I tried to execute source ~/.bash_profile in new command in terminal and the result was bash_profile after source command



After that i also run the command echo $PATH. and the result was this :bash_profile after echo $PATH. Command



I have no idea what i did. And what i need to do to fix the problem. Any help will be truly appreciated.










share|improve this question









New contributor




Biswajyoti Roy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Do you have any shells still working? The quick fix would be to move / delete / rename the file you edited. It has a syntax error that's blocking the startup. If not, we'll see what the next steps are like make a new admin account should you have none and then get control again

    – bmike
    8 hours ago
















4















I am new to the command line and clearly messed up my setup.




  • macOS High Sierra(10.13.6)

  • Trying to set up Python and VScode.


My path variable is what I believe is wrong, but Idon't know exactly how to get a shell and fix things.



It is now showing the user name when i go into terminal. After trying everything i tried to follow. https://shellzero.wordpress.com/tag/reset-path-on-mac/
My Terminal now looks like thisTerminal



My bash profile currently looks like this when i enter open .bash_profile in new command on terminalbash_profile text file



according to the suggestion of the article mentioned above, after entering export PATH=/usr/bin:/usr/sbin:/bin:/sbin and save the text file by command+S
I tried to execute source ~/.bash_profile in new command in terminal and the result was bash_profile after source command



After that i also run the command echo $PATH. and the result was this :bash_profile after echo $PATH. Command



I have no idea what i did. And what i need to do to fix the problem. Any help will be truly appreciated.










share|improve this question









New contributor




Biswajyoti Roy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Do you have any shells still working? The quick fix would be to move / delete / rename the file you edited. It has a syntax error that's blocking the startup. If not, we'll see what the next steps are like make a new admin account should you have none and then get control again

    – bmike
    8 hours ago














4












4








4








I am new to the command line and clearly messed up my setup.




  • macOS High Sierra(10.13.6)

  • Trying to set up Python and VScode.


My path variable is what I believe is wrong, but Idon't know exactly how to get a shell and fix things.



It is now showing the user name when i go into terminal. After trying everything i tried to follow. https://shellzero.wordpress.com/tag/reset-path-on-mac/
My Terminal now looks like thisTerminal



My bash profile currently looks like this when i enter open .bash_profile in new command on terminalbash_profile text file



according to the suggestion of the article mentioned above, after entering export PATH=/usr/bin:/usr/sbin:/bin:/sbin and save the text file by command+S
I tried to execute source ~/.bash_profile in new command in terminal and the result was bash_profile after source command



After that i also run the command echo $PATH. and the result was this :bash_profile after echo $PATH. Command



I have no idea what i did. And what i need to do to fix the problem. Any help will be truly appreciated.










share|improve this question









New contributor




Biswajyoti Roy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I am new to the command line and clearly messed up my setup.




  • macOS High Sierra(10.13.6)

  • Trying to set up Python and VScode.


My path variable is what I believe is wrong, but Idon't know exactly how to get a shell and fix things.



It is now showing the user name when i go into terminal. After trying everything i tried to follow. https://shellzero.wordpress.com/tag/reset-path-on-mac/
My Terminal now looks like thisTerminal



My bash profile currently looks like this when i enter open .bash_profile in new command on terminalbash_profile text file



according to the suggestion of the article mentioned above, after entering export PATH=/usr/bin:/usr/sbin:/bin:/sbin and save the text file by command+S
I tried to execute source ~/.bash_profile in new command in terminal and the result was bash_profile after source command



After that i also run the command echo $PATH. and the result was this :bash_profile after echo $PATH. Command



I have no idea what i did. And what i need to do to fix the problem. Any help will be truly appreciated.







macos terminal command-line bash path






share|improve this question









New contributor




Biswajyoti Roy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Biswajyoti Roy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 7 hours ago









bmike

159k46285617




159k46285617






New contributor




Biswajyoti Roy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 8 hours ago









Biswajyoti RoyBiswajyoti Roy

232




232




New contributor




Biswajyoti Roy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Biswajyoti Roy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Biswajyoti Roy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • Do you have any shells still working? The quick fix would be to move / delete / rename the file you edited. It has a syntax error that's blocking the startup. If not, we'll see what the next steps are like make a new admin account should you have none and then get control again

    – bmike
    8 hours ago



















  • Do you have any shells still working? The quick fix would be to move / delete / rename the file you edited. It has a syntax error that's blocking the startup. If not, we'll see what the next steps are like make a new admin account should you have none and then get control again

    – bmike
    8 hours ago

















Do you have any shells still working? The quick fix would be to move / delete / rename the file you edited. It has a syntax error that's blocking the startup. If not, we'll see what the next steps are like make a new admin account should you have none and then get control again

– bmike
8 hours ago





Do you have any shells still working? The quick fix would be to move / delete / rename the file you edited. It has a syntax error that's blocking the startup. If not, we'll see what the next steps are like make a new admin account should you have none and then get control again

– bmike
8 hours ago










2 Answers
2






active

oldest

votes


















3














OK - no worries. You did in fact mess things up, but here's an easy way to fix things.




  • Open TextEdit (or whatever editor you like graphically on the Mac)

  • Open a file and go to your home folder (click or press Command Shift G and type ~ and return)

  • Show hidden files (if needed) - Command + Shift + .

  • Open .bash_profile


Delete everything or comment out anything that contains PATH= and save the file (you can save as to save it to your Desktop if you want to fix it up rather than start new).



Then open a new terminal window to check your work. If it works, close out the broken sessions and make sure you incorporate the old path when you add things:



This is safe:



export PATH="/usr/local/sbin:$PATH:/path/to/whatever/bin"


It's safe since the old $PATH is included on the right of the =



What isn't safe is when



export PATH="whatever"


All the other parts of the path are now gone, with only whatever left and the last = wins, so your path is missing very important items instead of adding things to the default path, you broke it temporarily. No worries, this is a phase of passage - everyone needs to break their shell dot files to learn. Welcome to the club.






share|improve this answer


























  • Thanks bmike.i will try to do that. My bash_profile has so so many stuff.IT will be tuff. BTW where should i put the new "export PATH="/usr/local/sbin:$PATH:$GEM_HOME/bin" in bash_profile? In the begining or in the end?

    – Biswajyoti Roy
    6 hours ago













  • my bash_profile is filled with so many code with PATH=".....' is it possible that i delete everything except the new line "export PATH="/usr/local/sbin:$PATH:$GEM_HOME/bin""

    – Biswajyoti Roy
    6 hours ago






  • 1





    It's also critical that you remove from the cat << EOF ... line through the EOF on a line by itself -- every time that runs, it adds another batch of garbled mess to the end of the .bash_profile itself. Frankly, I think it'll be easier to dump it, and start over (see my answer).

    – Gordon Davisson
    5 hours ago











  • @bmike I cant really thank you enough!!

    – Biswajyoti Roy
    5 hours ago



















3














I'd recommend a somewhat different approach from @bmike: rather than trying to remove the bad parts from the current file, start over and add back just the good parts. It looks like there's a lot more bad than good in the current file, so this should be simpler.



What's really really really bad in the current file is the section that starts like this:



cat << EOF >> ~/.bash_profile


...and somewhere down below that there'll be EOF alone on a line. The problem is that this isn't an instruction to set up your environment, it's instructions to add instructions to your ~/.bash_profile. In other words, every time your ~/.bash_profile runs, it adds another copy of the stuff between cat and EOF to the end of ~/.bash_profile, so the file gets longer and longer and longer... and has more and more copies of the messed up instructions.



At this point, your ~/.bash_profile will be huge, and mostly garbled nonsense.



So, I recommend starting over. Rename and save the current file, so you can refer back to it if necessary, then create a new blank .bash_profile in your home directory. I recommend BBEdit for this -- it has a free demo mode that'll do everything you need here, and (unlike most text editors) it won't do "helpful" things like converting plain ASCII quotes (like ") to fancy unicode quotes (like and ) that mess up shell scripts. It also doesn't complain about saving files with names that start with ".".



From the section visible in your screenshot, this is the only part of the current file that looks right:



# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
# Add Visual Studio Code (code)
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"


There might be something you actually want further down, but since the cat part starts shortly after that I doubt it. In any case, this should be enough to get you a basically functional setup; if there are some things that still don't work, you may have to look through the old file for other things that need salvaging.






share|improve this answer
























  • I Have billions of code in the bash_profile.So it vary hard for me to pick & Choose. Moreover i already uninstall and deleted python3,VScode. I was wondering if i delete everything on bash and just keep this one line code "export PATH=/usr/bin:/usr/sbin:/bin:/sbin" in th bash_profile. is it posiible to fix the issue? i am in real urgency.so fixing this thing quick is a big deal. later i can reinstall all the programs which should be fine? Thanks a lot again.I really Really appreciate your help

    – Biswajyoti Roy
    5 hours ago











  • Are you still using Visual Studio Code? If so, I'd keep just the last two lines of what I have above. If you're not using VS Code, just remove the .bash_profile entirely (but keep a backup, just in case). PATH should be automatically set to a reasonable (but basic) value without the file. If you do need to set it for some reason, PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin is the original default, and I'd recommend using that.

    – Gordon Davisson
    5 hours ago













  • I just deleted everything and just kept the line "export PATH=/usr/bin:/usr/sbin:/bin:/sbin" now seems like the terminal running again. I Just got this back: [braeburn:~ [username]$ echo $PATH. /usr/bin:/usr/sbin:/bin:/sbin.]

    – Biswajyoti Roy
    5 hours ago













  • That's pretty close to the standard PATH, but it's missing /usr/local/bin. I'd recommend either removing that line (leaving the default PATH), or force the standard value with export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

    – Gordon Davisson
    5 hours ago











  • BTW i removed my previous SQL path [export PATH="/usr/local/mysql/bin:$PATH"], If i want to add it again to my bash_profile (otherwise MYSQL dont run for some reason) what should be the safe code?

    – Biswajyoti Roy
    5 hours ago











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "118"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Biswajyoti Roy is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fapple.stackexchange.com%2fquestions%2f351000%2fhow-can-i-fix-my-terminal-when-editing-the-path-in-bash-profile-has-the-startup%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














OK - no worries. You did in fact mess things up, but here's an easy way to fix things.




  • Open TextEdit (or whatever editor you like graphically on the Mac)

  • Open a file and go to your home folder (click or press Command Shift G and type ~ and return)

  • Show hidden files (if needed) - Command + Shift + .

  • Open .bash_profile


Delete everything or comment out anything that contains PATH= and save the file (you can save as to save it to your Desktop if you want to fix it up rather than start new).



Then open a new terminal window to check your work. If it works, close out the broken sessions and make sure you incorporate the old path when you add things:



This is safe:



export PATH="/usr/local/sbin:$PATH:/path/to/whatever/bin"


It's safe since the old $PATH is included on the right of the =



What isn't safe is when



export PATH="whatever"


All the other parts of the path are now gone, with only whatever left and the last = wins, so your path is missing very important items instead of adding things to the default path, you broke it temporarily. No worries, this is a phase of passage - everyone needs to break their shell dot files to learn. Welcome to the club.






share|improve this answer


























  • Thanks bmike.i will try to do that. My bash_profile has so so many stuff.IT will be tuff. BTW where should i put the new "export PATH="/usr/local/sbin:$PATH:$GEM_HOME/bin" in bash_profile? In the begining or in the end?

    – Biswajyoti Roy
    6 hours ago













  • my bash_profile is filled with so many code with PATH=".....' is it possible that i delete everything except the new line "export PATH="/usr/local/sbin:$PATH:$GEM_HOME/bin""

    – Biswajyoti Roy
    6 hours ago






  • 1





    It's also critical that you remove from the cat << EOF ... line through the EOF on a line by itself -- every time that runs, it adds another batch of garbled mess to the end of the .bash_profile itself. Frankly, I think it'll be easier to dump it, and start over (see my answer).

    – Gordon Davisson
    5 hours ago











  • @bmike I cant really thank you enough!!

    – Biswajyoti Roy
    5 hours ago
















3














OK - no worries. You did in fact mess things up, but here's an easy way to fix things.




  • Open TextEdit (or whatever editor you like graphically on the Mac)

  • Open a file and go to your home folder (click or press Command Shift G and type ~ and return)

  • Show hidden files (if needed) - Command + Shift + .

  • Open .bash_profile


Delete everything or comment out anything that contains PATH= and save the file (you can save as to save it to your Desktop if you want to fix it up rather than start new).



Then open a new terminal window to check your work. If it works, close out the broken sessions and make sure you incorporate the old path when you add things:



This is safe:



export PATH="/usr/local/sbin:$PATH:/path/to/whatever/bin"


It's safe since the old $PATH is included on the right of the =



What isn't safe is when



export PATH="whatever"


All the other parts of the path are now gone, with only whatever left and the last = wins, so your path is missing very important items instead of adding things to the default path, you broke it temporarily. No worries, this is a phase of passage - everyone needs to break their shell dot files to learn. Welcome to the club.






share|improve this answer


























  • Thanks bmike.i will try to do that. My bash_profile has so so many stuff.IT will be tuff. BTW where should i put the new "export PATH="/usr/local/sbin:$PATH:$GEM_HOME/bin" in bash_profile? In the begining or in the end?

    – Biswajyoti Roy
    6 hours ago













  • my bash_profile is filled with so many code with PATH=".....' is it possible that i delete everything except the new line "export PATH="/usr/local/sbin:$PATH:$GEM_HOME/bin""

    – Biswajyoti Roy
    6 hours ago






  • 1





    It's also critical that you remove from the cat << EOF ... line through the EOF on a line by itself -- every time that runs, it adds another batch of garbled mess to the end of the .bash_profile itself. Frankly, I think it'll be easier to dump it, and start over (see my answer).

    – Gordon Davisson
    5 hours ago











  • @bmike I cant really thank you enough!!

    – Biswajyoti Roy
    5 hours ago














3












3








3







OK - no worries. You did in fact mess things up, but here's an easy way to fix things.




  • Open TextEdit (or whatever editor you like graphically on the Mac)

  • Open a file and go to your home folder (click or press Command Shift G and type ~ and return)

  • Show hidden files (if needed) - Command + Shift + .

  • Open .bash_profile


Delete everything or comment out anything that contains PATH= and save the file (you can save as to save it to your Desktop if you want to fix it up rather than start new).



Then open a new terminal window to check your work. If it works, close out the broken sessions and make sure you incorporate the old path when you add things:



This is safe:



export PATH="/usr/local/sbin:$PATH:/path/to/whatever/bin"


It's safe since the old $PATH is included on the right of the =



What isn't safe is when



export PATH="whatever"


All the other parts of the path are now gone, with only whatever left and the last = wins, so your path is missing very important items instead of adding things to the default path, you broke it temporarily. No worries, this is a phase of passage - everyone needs to break their shell dot files to learn. Welcome to the club.






share|improve this answer















OK - no worries. You did in fact mess things up, but here's an easy way to fix things.




  • Open TextEdit (or whatever editor you like graphically on the Mac)

  • Open a file and go to your home folder (click or press Command Shift G and type ~ and return)

  • Show hidden files (if needed) - Command + Shift + .

  • Open .bash_profile


Delete everything or comment out anything that contains PATH= and save the file (you can save as to save it to your Desktop if you want to fix it up rather than start new).



Then open a new terminal window to check your work. If it works, close out the broken sessions and make sure you incorporate the old path when you add things:



This is safe:



export PATH="/usr/local/sbin:$PATH:/path/to/whatever/bin"


It's safe since the old $PATH is included on the right of the =



What isn't safe is when



export PATH="whatever"


All the other parts of the path are now gone, with only whatever left and the last = wins, so your path is missing very important items instead of adding things to the default path, you broke it temporarily. No worries, this is a phase of passage - everyone needs to break their shell dot files to learn. Welcome to the club.







share|improve this answer














share|improve this answer



share|improve this answer








edited 4 hours ago

























answered 6 hours ago









bmikebmike

159k46285617




159k46285617













  • Thanks bmike.i will try to do that. My bash_profile has so so many stuff.IT will be tuff. BTW where should i put the new "export PATH="/usr/local/sbin:$PATH:$GEM_HOME/bin" in bash_profile? In the begining or in the end?

    – Biswajyoti Roy
    6 hours ago













  • my bash_profile is filled with so many code with PATH=".....' is it possible that i delete everything except the new line "export PATH="/usr/local/sbin:$PATH:$GEM_HOME/bin""

    – Biswajyoti Roy
    6 hours ago






  • 1





    It's also critical that you remove from the cat << EOF ... line through the EOF on a line by itself -- every time that runs, it adds another batch of garbled mess to the end of the .bash_profile itself. Frankly, I think it'll be easier to dump it, and start over (see my answer).

    – Gordon Davisson
    5 hours ago











  • @bmike I cant really thank you enough!!

    – Biswajyoti Roy
    5 hours ago



















  • Thanks bmike.i will try to do that. My bash_profile has so so many stuff.IT will be tuff. BTW where should i put the new "export PATH="/usr/local/sbin:$PATH:$GEM_HOME/bin" in bash_profile? In the begining or in the end?

    – Biswajyoti Roy
    6 hours ago













  • my bash_profile is filled with so many code with PATH=".....' is it possible that i delete everything except the new line "export PATH="/usr/local/sbin:$PATH:$GEM_HOME/bin""

    – Biswajyoti Roy
    6 hours ago






  • 1





    It's also critical that you remove from the cat << EOF ... line through the EOF on a line by itself -- every time that runs, it adds another batch of garbled mess to the end of the .bash_profile itself. Frankly, I think it'll be easier to dump it, and start over (see my answer).

    – Gordon Davisson
    5 hours ago











  • @bmike I cant really thank you enough!!

    – Biswajyoti Roy
    5 hours ago

















Thanks bmike.i will try to do that. My bash_profile has so so many stuff.IT will be tuff. BTW where should i put the new "export PATH="/usr/local/sbin:$PATH:$GEM_HOME/bin" in bash_profile? In the begining or in the end?

– Biswajyoti Roy
6 hours ago







Thanks bmike.i will try to do that. My bash_profile has so so many stuff.IT will be tuff. BTW where should i put the new "export PATH="/usr/local/sbin:$PATH:$GEM_HOME/bin" in bash_profile? In the begining or in the end?

– Biswajyoti Roy
6 hours ago















my bash_profile is filled with so many code with PATH=".....' is it possible that i delete everything except the new line "export PATH="/usr/local/sbin:$PATH:$GEM_HOME/bin""

– Biswajyoti Roy
6 hours ago





my bash_profile is filled with so many code with PATH=".....' is it possible that i delete everything except the new line "export PATH="/usr/local/sbin:$PATH:$GEM_HOME/bin""

– Biswajyoti Roy
6 hours ago




1




1





It's also critical that you remove from the cat << EOF ... line through the EOF on a line by itself -- every time that runs, it adds another batch of garbled mess to the end of the .bash_profile itself. Frankly, I think it'll be easier to dump it, and start over (see my answer).

– Gordon Davisson
5 hours ago





It's also critical that you remove from the cat << EOF ... line through the EOF on a line by itself -- every time that runs, it adds another batch of garbled mess to the end of the .bash_profile itself. Frankly, I think it'll be easier to dump it, and start over (see my answer).

– Gordon Davisson
5 hours ago













@bmike I cant really thank you enough!!

– Biswajyoti Roy
5 hours ago





@bmike I cant really thank you enough!!

– Biswajyoti Roy
5 hours ago













3














I'd recommend a somewhat different approach from @bmike: rather than trying to remove the bad parts from the current file, start over and add back just the good parts. It looks like there's a lot more bad than good in the current file, so this should be simpler.



What's really really really bad in the current file is the section that starts like this:



cat << EOF >> ~/.bash_profile


...and somewhere down below that there'll be EOF alone on a line. The problem is that this isn't an instruction to set up your environment, it's instructions to add instructions to your ~/.bash_profile. In other words, every time your ~/.bash_profile runs, it adds another copy of the stuff between cat and EOF to the end of ~/.bash_profile, so the file gets longer and longer and longer... and has more and more copies of the messed up instructions.



At this point, your ~/.bash_profile will be huge, and mostly garbled nonsense.



So, I recommend starting over. Rename and save the current file, so you can refer back to it if necessary, then create a new blank .bash_profile in your home directory. I recommend BBEdit for this -- it has a free demo mode that'll do everything you need here, and (unlike most text editors) it won't do "helpful" things like converting plain ASCII quotes (like ") to fancy unicode quotes (like and ) that mess up shell scripts. It also doesn't complain about saving files with names that start with ".".



From the section visible in your screenshot, this is the only part of the current file that looks right:



# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
# Add Visual Studio Code (code)
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"


There might be something you actually want further down, but since the cat part starts shortly after that I doubt it. In any case, this should be enough to get you a basically functional setup; if there are some things that still don't work, you may have to look through the old file for other things that need salvaging.






share|improve this answer
























  • I Have billions of code in the bash_profile.So it vary hard for me to pick & Choose. Moreover i already uninstall and deleted python3,VScode. I was wondering if i delete everything on bash and just keep this one line code "export PATH=/usr/bin:/usr/sbin:/bin:/sbin" in th bash_profile. is it posiible to fix the issue? i am in real urgency.so fixing this thing quick is a big deal. later i can reinstall all the programs which should be fine? Thanks a lot again.I really Really appreciate your help

    – Biswajyoti Roy
    5 hours ago











  • Are you still using Visual Studio Code? If so, I'd keep just the last two lines of what I have above. If you're not using VS Code, just remove the .bash_profile entirely (but keep a backup, just in case). PATH should be automatically set to a reasonable (but basic) value without the file. If you do need to set it for some reason, PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin is the original default, and I'd recommend using that.

    – Gordon Davisson
    5 hours ago













  • I just deleted everything and just kept the line "export PATH=/usr/bin:/usr/sbin:/bin:/sbin" now seems like the terminal running again. I Just got this back: [braeburn:~ [username]$ echo $PATH. /usr/bin:/usr/sbin:/bin:/sbin.]

    – Biswajyoti Roy
    5 hours ago













  • That's pretty close to the standard PATH, but it's missing /usr/local/bin. I'd recommend either removing that line (leaving the default PATH), or force the standard value with export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

    – Gordon Davisson
    5 hours ago











  • BTW i removed my previous SQL path [export PATH="/usr/local/mysql/bin:$PATH"], If i want to add it again to my bash_profile (otherwise MYSQL dont run for some reason) what should be the safe code?

    – Biswajyoti Roy
    5 hours ago
















3














I'd recommend a somewhat different approach from @bmike: rather than trying to remove the bad parts from the current file, start over and add back just the good parts. It looks like there's a lot more bad than good in the current file, so this should be simpler.



What's really really really bad in the current file is the section that starts like this:



cat << EOF >> ~/.bash_profile


...and somewhere down below that there'll be EOF alone on a line. The problem is that this isn't an instruction to set up your environment, it's instructions to add instructions to your ~/.bash_profile. In other words, every time your ~/.bash_profile runs, it adds another copy of the stuff between cat and EOF to the end of ~/.bash_profile, so the file gets longer and longer and longer... and has more and more copies of the messed up instructions.



At this point, your ~/.bash_profile will be huge, and mostly garbled nonsense.



So, I recommend starting over. Rename and save the current file, so you can refer back to it if necessary, then create a new blank .bash_profile in your home directory. I recommend BBEdit for this -- it has a free demo mode that'll do everything you need here, and (unlike most text editors) it won't do "helpful" things like converting plain ASCII quotes (like ") to fancy unicode quotes (like and ) that mess up shell scripts. It also doesn't complain about saving files with names that start with ".".



From the section visible in your screenshot, this is the only part of the current file that looks right:



# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
# Add Visual Studio Code (code)
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"


There might be something you actually want further down, but since the cat part starts shortly after that I doubt it. In any case, this should be enough to get you a basically functional setup; if there are some things that still don't work, you may have to look through the old file for other things that need salvaging.






share|improve this answer
























  • I Have billions of code in the bash_profile.So it vary hard for me to pick & Choose. Moreover i already uninstall and deleted python3,VScode. I was wondering if i delete everything on bash and just keep this one line code "export PATH=/usr/bin:/usr/sbin:/bin:/sbin" in th bash_profile. is it posiible to fix the issue? i am in real urgency.so fixing this thing quick is a big deal. later i can reinstall all the programs which should be fine? Thanks a lot again.I really Really appreciate your help

    – Biswajyoti Roy
    5 hours ago











  • Are you still using Visual Studio Code? If so, I'd keep just the last two lines of what I have above. If you're not using VS Code, just remove the .bash_profile entirely (but keep a backup, just in case). PATH should be automatically set to a reasonable (but basic) value without the file. If you do need to set it for some reason, PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin is the original default, and I'd recommend using that.

    – Gordon Davisson
    5 hours ago













  • I just deleted everything and just kept the line "export PATH=/usr/bin:/usr/sbin:/bin:/sbin" now seems like the terminal running again. I Just got this back: [braeburn:~ [username]$ echo $PATH. /usr/bin:/usr/sbin:/bin:/sbin.]

    – Biswajyoti Roy
    5 hours ago













  • That's pretty close to the standard PATH, but it's missing /usr/local/bin. I'd recommend either removing that line (leaving the default PATH), or force the standard value with export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

    – Gordon Davisson
    5 hours ago











  • BTW i removed my previous SQL path [export PATH="/usr/local/mysql/bin:$PATH"], If i want to add it again to my bash_profile (otherwise MYSQL dont run for some reason) what should be the safe code?

    – Biswajyoti Roy
    5 hours ago














3












3








3







I'd recommend a somewhat different approach from @bmike: rather than trying to remove the bad parts from the current file, start over and add back just the good parts. It looks like there's a lot more bad than good in the current file, so this should be simpler.



What's really really really bad in the current file is the section that starts like this:



cat << EOF >> ~/.bash_profile


...and somewhere down below that there'll be EOF alone on a line. The problem is that this isn't an instruction to set up your environment, it's instructions to add instructions to your ~/.bash_profile. In other words, every time your ~/.bash_profile runs, it adds another copy of the stuff between cat and EOF to the end of ~/.bash_profile, so the file gets longer and longer and longer... and has more and more copies of the messed up instructions.



At this point, your ~/.bash_profile will be huge, and mostly garbled nonsense.



So, I recommend starting over. Rename and save the current file, so you can refer back to it if necessary, then create a new blank .bash_profile in your home directory. I recommend BBEdit for this -- it has a free demo mode that'll do everything you need here, and (unlike most text editors) it won't do "helpful" things like converting plain ASCII quotes (like ") to fancy unicode quotes (like and ) that mess up shell scripts. It also doesn't complain about saving files with names that start with ".".



From the section visible in your screenshot, this is the only part of the current file that looks right:



# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
# Add Visual Studio Code (code)
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"


There might be something you actually want further down, but since the cat part starts shortly after that I doubt it. In any case, this should be enough to get you a basically functional setup; if there are some things that still don't work, you may have to look through the old file for other things that need salvaging.






share|improve this answer













I'd recommend a somewhat different approach from @bmike: rather than trying to remove the bad parts from the current file, start over and add back just the good parts. It looks like there's a lot more bad than good in the current file, so this should be simpler.



What's really really really bad in the current file is the section that starts like this:



cat << EOF >> ~/.bash_profile


...and somewhere down below that there'll be EOF alone on a line. The problem is that this isn't an instruction to set up your environment, it's instructions to add instructions to your ~/.bash_profile. In other words, every time your ~/.bash_profile runs, it adds another copy of the stuff between cat and EOF to the end of ~/.bash_profile, so the file gets longer and longer and longer... and has more and more copies of the messed up instructions.



At this point, your ~/.bash_profile will be huge, and mostly garbled nonsense.



So, I recommend starting over. Rename and save the current file, so you can refer back to it if necessary, then create a new blank .bash_profile in your home directory. I recommend BBEdit for this -- it has a free demo mode that'll do everything you need here, and (unlike most text editors) it won't do "helpful" things like converting plain ASCII quotes (like ") to fancy unicode quotes (like and ) that mess up shell scripts. It also doesn't complain about saving files with names that start with ".".



From the section visible in your screenshot, this is the only part of the current file that looks right:



# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
# Add Visual Studio Code (code)
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"


There might be something you actually want further down, but since the cat part starts shortly after that I doubt it. In any case, this should be enough to get you a basically functional setup; if there are some things that still don't work, you may have to look through the old file for other things that need salvaging.







share|improve this answer












share|improve this answer



share|improve this answer










answered 5 hours ago









Gordon DavissonGordon Davisson

22k34356




22k34356













  • I Have billions of code in the bash_profile.So it vary hard for me to pick & Choose. Moreover i already uninstall and deleted python3,VScode. I was wondering if i delete everything on bash and just keep this one line code "export PATH=/usr/bin:/usr/sbin:/bin:/sbin" in th bash_profile. is it posiible to fix the issue? i am in real urgency.so fixing this thing quick is a big deal. later i can reinstall all the programs which should be fine? Thanks a lot again.I really Really appreciate your help

    – Biswajyoti Roy
    5 hours ago











  • Are you still using Visual Studio Code? If so, I'd keep just the last two lines of what I have above. If you're not using VS Code, just remove the .bash_profile entirely (but keep a backup, just in case). PATH should be automatically set to a reasonable (but basic) value without the file. If you do need to set it for some reason, PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin is the original default, and I'd recommend using that.

    – Gordon Davisson
    5 hours ago













  • I just deleted everything and just kept the line "export PATH=/usr/bin:/usr/sbin:/bin:/sbin" now seems like the terminal running again. I Just got this back: [braeburn:~ [username]$ echo $PATH. /usr/bin:/usr/sbin:/bin:/sbin.]

    – Biswajyoti Roy
    5 hours ago













  • That's pretty close to the standard PATH, but it's missing /usr/local/bin. I'd recommend either removing that line (leaving the default PATH), or force the standard value with export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

    – Gordon Davisson
    5 hours ago











  • BTW i removed my previous SQL path [export PATH="/usr/local/mysql/bin:$PATH"], If i want to add it again to my bash_profile (otherwise MYSQL dont run for some reason) what should be the safe code?

    – Biswajyoti Roy
    5 hours ago



















  • I Have billions of code in the bash_profile.So it vary hard for me to pick & Choose. Moreover i already uninstall and deleted python3,VScode. I was wondering if i delete everything on bash and just keep this one line code "export PATH=/usr/bin:/usr/sbin:/bin:/sbin" in th bash_profile. is it posiible to fix the issue? i am in real urgency.so fixing this thing quick is a big deal. later i can reinstall all the programs which should be fine? Thanks a lot again.I really Really appreciate your help

    – Biswajyoti Roy
    5 hours ago











  • Are you still using Visual Studio Code? If so, I'd keep just the last two lines of what I have above. If you're not using VS Code, just remove the .bash_profile entirely (but keep a backup, just in case). PATH should be automatically set to a reasonable (but basic) value without the file. If you do need to set it for some reason, PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin is the original default, and I'd recommend using that.

    – Gordon Davisson
    5 hours ago













  • I just deleted everything and just kept the line "export PATH=/usr/bin:/usr/sbin:/bin:/sbin" now seems like the terminal running again. I Just got this back: [braeburn:~ [username]$ echo $PATH. /usr/bin:/usr/sbin:/bin:/sbin.]

    – Biswajyoti Roy
    5 hours ago













  • That's pretty close to the standard PATH, but it's missing /usr/local/bin. I'd recommend either removing that line (leaving the default PATH), or force the standard value with export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

    – Gordon Davisson
    5 hours ago











  • BTW i removed my previous SQL path [export PATH="/usr/local/mysql/bin:$PATH"], If i want to add it again to my bash_profile (otherwise MYSQL dont run for some reason) what should be the safe code?

    – Biswajyoti Roy
    5 hours ago

















I Have billions of code in the bash_profile.So it vary hard for me to pick & Choose. Moreover i already uninstall and deleted python3,VScode. I was wondering if i delete everything on bash and just keep this one line code "export PATH=/usr/bin:/usr/sbin:/bin:/sbin" in th bash_profile. is it posiible to fix the issue? i am in real urgency.so fixing this thing quick is a big deal. later i can reinstall all the programs which should be fine? Thanks a lot again.I really Really appreciate your help

– Biswajyoti Roy
5 hours ago





I Have billions of code in the bash_profile.So it vary hard for me to pick & Choose. Moreover i already uninstall and deleted python3,VScode. I was wondering if i delete everything on bash and just keep this one line code "export PATH=/usr/bin:/usr/sbin:/bin:/sbin" in th bash_profile. is it posiible to fix the issue? i am in real urgency.so fixing this thing quick is a big deal. later i can reinstall all the programs which should be fine? Thanks a lot again.I really Really appreciate your help

– Biswajyoti Roy
5 hours ago













Are you still using Visual Studio Code? If so, I'd keep just the last two lines of what I have above. If you're not using VS Code, just remove the .bash_profile entirely (but keep a backup, just in case). PATH should be automatically set to a reasonable (but basic) value without the file. If you do need to set it for some reason, PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin is the original default, and I'd recommend using that.

– Gordon Davisson
5 hours ago







Are you still using Visual Studio Code? If so, I'd keep just the last two lines of what I have above. If you're not using VS Code, just remove the .bash_profile entirely (but keep a backup, just in case). PATH should be automatically set to a reasonable (but basic) value without the file. If you do need to set it for some reason, PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin is the original default, and I'd recommend using that.

– Gordon Davisson
5 hours ago















I just deleted everything and just kept the line "export PATH=/usr/bin:/usr/sbin:/bin:/sbin" now seems like the terminal running again. I Just got this back: [braeburn:~ [username]$ echo $PATH. /usr/bin:/usr/sbin:/bin:/sbin.]

– Biswajyoti Roy
5 hours ago







I just deleted everything and just kept the line "export PATH=/usr/bin:/usr/sbin:/bin:/sbin" now seems like the terminal running again. I Just got this back: [braeburn:~ [username]$ echo $PATH. /usr/bin:/usr/sbin:/bin:/sbin.]

– Biswajyoti Roy
5 hours ago















That's pretty close to the standard PATH, but it's missing /usr/local/bin. I'd recommend either removing that line (leaving the default PATH), or force the standard value with export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

– Gordon Davisson
5 hours ago





That's pretty close to the standard PATH, but it's missing /usr/local/bin. I'd recommend either removing that line (leaving the default PATH), or force the standard value with export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

– Gordon Davisson
5 hours ago













BTW i removed my previous SQL path [export PATH="/usr/local/mysql/bin:$PATH"], If i want to add it again to my bash_profile (otherwise MYSQL dont run for some reason) what should be the safe code?

– Biswajyoti Roy
5 hours ago





BTW i removed my previous SQL path [export PATH="/usr/local/mysql/bin:$PATH"], If i want to add it again to my bash_profile (otherwise MYSQL dont run for some reason) what should be the safe code?

– Biswajyoti Roy
5 hours ago










Biswajyoti Roy is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Biswajyoti Roy is a new contributor. Be nice, and check out our Code of Conduct.













Biswajyoti Roy is a new contributor. Be nice, and check out our Code of Conduct.












Biswajyoti Roy is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Ask Different!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fapple.stackexchange.com%2fquestions%2f351000%2fhow-can-i-fix-my-terminal-when-editing-the-path-in-bash-profile-has-the-startup%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Ponta tanko

Tantalo (mitologio)

Erzsébet Schaár