Terminal modified permanently by vscode - bash

I installed vscode today and followed the steps on tutorials on youtube to set up. My terminal started to act weird after I called python through the terminal and tried to use pip install command but failed. I uninstalled the app, deleted all the relevant files, and tried to reopen the terminal. The terminal still has the same warnings.
I have contacted Apple Tech support and they say my terminal got modified by the app. They asked me to contact the app developer.
I don't know what I did to get where I am now. I would appreciate any help that can bring my terminal back to normal.
Below are the warnings even after I uninstalled the app:
Last login: Wed Jun 10 23:02:45 on ttys000
You have mail.
-bash: Saving: command not found
-bash: ...copying: command not found
-bash: ...saving: command not found
-bash: ...completed.: command not found
-bash: Deleting: command not found
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
ZhouChristinas-MacBook-Pro:~ zhouchristina$

Check your shell's startup script, it looks like you have text there that aren't shell commands. I don't know whether you have bash or zsh as your shell, but check all of these files just to be sure:
~/.bashrc
~/.bash_aliases
~/.bash_profile
~/.bash_login
~/.zshrc
~/.zshenv
~/.zprofile
~/.zlogin
~/.profile
Also look into any files that are sourced by these files.

Related

Show Git Branch Name in Terminal - MacOS Catalina - missing zsh files

I have a fresh MacOS Catalina 10.15.6 and I'm following the steps on this link show git branch name in terminal macos so I can display the branch name on my terminal whenever I cd in a git repository.
I'm in my home directory so when I run ls -la, I can't see any of the following files
.zshrc, .bashrc, .bash_profile, .zprofile
The only relevant files showing on the list are .bash_history and .zsh_history.
Are these located on a different path or am I missing any step in the process?
MACOS Instructions- execute the following commands in your terminal:
cd
nano .zshrc
copy and paste this lines of code:
autoload -Uz vcs_info
precmd() {vcs_info}
zstyle ':vcs_info:git:*' formats '(%b)'
setopt PROMPT_SUBST
PROMPT='%n> ${PWD/#$HOME/~} ${vcs_info_msg_0_}%%'
CTRL+o ENTER to save and CTRL+x to exit
source .zshrc
and that's it. Please share your configuration!
Simplest answer, install Oh My ZSH
Trust me, you can't do a better job customizing your own .zshrc file.
Just go here: https://ohmyz.sh/#install
Run this command in your terminal:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Voila, you got pretty terminal outputs
Following this answer on SuperUser StackExchange, I would assume that you have to create .zshrc, .bashrc, etc., on your own. As far as I can tell, you just need a .zshrc for what you are doing. Then you can continue with the setup from the tutorial.

zsh: command not found -- no longer have access to basic utilities and all installed softwares or packages from the terminal

Looks like I have managed to scramble my path variable when installing flutter, and now running yarn, shows zsh: command not found: yarn
This was the command I ran that I started experiencing the zsh command not found:
echo 'export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin >> ~/.zshrc"
I ran the code solution suggested by #devnull https://stackoverflow.com/a/18428774/1766068
PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
export PATH it would work when I open a new tab, but if I should restart the terminal it no longer works.
Open your ~/.zshrc file in a text editor and remove the last line. Then logout and login again.

Bash CLI is not behaving after upgrading Mac to Catalina

I was previously on Mojave but was forced to update because of XCode.
When it finished installing, I had to change the default Login Shell, because Catalina now uses Z Shell.
After I did that, my CLI still looks and acts very different:
BEFORE:
This is what it currently looks like:
AFTER:
I googled' line 33: __rvm_read_lines _hooks_list <(' and was advised to run: source ~/.bashrc. Nothing changed, until I ran source ./bash_profile and it started to somewhat feel better, but it still not performing commands properly. There is always some error.
Lastly, why do I have to run source ~/.bash_profile every time? I just want this to be back to normal.
After the upgrade, my CLI actually gave me this message:
The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
For more details, please visit https://support.apple.com/kb/HT208050.
Foolishly, I ran that command, hoping it would go away.
It was fixed by switching back to chsh -s /bin/bash not sh.

Why when I open terminal do I see the following:

Last login: Mon Jun 17 10:41:49 on ttys000
-bash: export: `2019.03': not a valid identifier
XXX:~ YYY$
(Note the XXXs and YYYs are just replacement)
Specifically, I am talking about the
-bash: export: `2019.03': not a valid identifier
I just installed Anaconda on Mac and then tried to update it and did in it incorrectly and now when I open the terminal, this appears every time. I know that 2019.03 is the current version of Anaconda and I have since fixed Anaconda so that my version is currently that version but I do not know what this "not a valid identifier" this is. Any help with how to address what it is, why it is there, and how I can remove it would be much appreciated.
EDIT: Thanks for assistance. I opened the bash profile and some of the comments was in the same line as the export path line and that was messing it up. Thank you!
If you open the terminal and see that there is some error coming from ~bash, it likely has something to do with the bash profile. You should open that up and check to make sure that nothing is out of place like having more than one thing on the same line since it can be sensitive to that.
You see the following due to the anaconda3 2019.03 installer trying to export a non valid identifier from your .bash_profile file. Note, this file is usually hidden due to the period in front of the file name.
The following is what was appearing in my terminal:
-bash: export: `2019.03': not a valid identifier
Do the following to fix this issue.
$ nano .bash_profile
Now you should be inside of the .bash_profile file using the nano editor.
# comment out or remove the following line from .bash_profile
# then save before you exit the file
#export PATH="MAMP_PHP:$PATH"# added by Anaconda3 2019.03 installer
Close your terminal and open it again, and the annoying "-bash: export: `2019.03': not a valid identifier" should be gone whenever you open a new terminal.

terminal doesn't work after running source ~/.bash_profile

I'm a new python user. When I was installing postgresql and running the following order:
$vi ~/.bash_profile
Add PATH=/usr/pgsql-9.2/bin:$PATH before export PATH.
$source ~/.bash_profile
My terminal became very strange. It seemed that I could not logout of the .bash_profile environment. When I use any basic comments like cd, open, etc., something strange happens.
This is my output:
MynametekiMacBook-Air:~ Myname$ cd Documents/
-bash: dirname: command not found
MynametekiMacBook-Air:Documents Myname$ open ~/.bash_profile
-bash: open: command not found
MynametekiMacBook-Air:Documents Myname$ easy_install pip
-bash: easy_install: command not found
How would I fix this?
If you enter
$nano ~/.bash_profile
you will be able to edit your bash profile, you can remove the line that you added that is causing problems and try again, or see if there is a syntax error in what was entered. Once you've finished your edits you need to press ctl+o then enter to confirm and ctl+x to exit back to the bash prompt.
run /bin/mv ~/.bash_profile ~/.bp. Close your terminal. Reopen and look at the new .bp file with vim ~/.bp. Fix any errors and run mv ~/.bp ~/.bash_profile to revert.
Try export PATH=$PATH:/usr/pgsql-9.2/bin instead of Add PATH=/usr/pgsql-9.2/bin:$PATH. Because it looks like you made so your paths are being overwritten instead of being updated.

Resources