Terminal error in mac - macos

I used to do something to change the looking my of macbook terminal(adding color to character, etc). However, since than, when ever I try "ls", it always gave the error like:
error : invalid character '' in LSCOLORS env var.
How to set up my env to fix it please?
Update: I fixed the problem by fix my .bash_profile in changing to
export LSCOLORS=ExFxCxDxBxegedabagacad

figure out your current setting - run 'grep "LSCOLORS=" ~/.bash_profile'
open your ~.bash_profile, find the LSCOLORS definition. Change it as follows:
export CLICOLOR=1
export LSCOLORS=Gxfxcxdxbxegedabagacad

You must have added a line beginning with LSCOLORS= some character to your .bash_profile. Open it in terminal with nano ~/.bash_profile or using TextEdit and remove that line.

Related

How to reset vim and neovim when sourcing wrong file .zshrc instead of init.vim

I'm using macOS Catalina which has built in Vim 8.1. I'm also using iTerm with zsh and oh-my-zsh. I installed neovim for my personal use and when I setting it up, I accidentally enter source .zshrc in Command mode instead of source init.vim. From then, when I open neovim or built in vim, it does not source init.vim anymore and shows error message like below:
Error detected while processing VIMINIT:
E33: No previous substitute regular expression
Press ENTER or type command to continue
There is a line in my .zshrc that exports VIMINIT variable
export VIMINIT="~/.config/nvim/init.vim"
How can I undo this or is there any other way to reset vim to original setting? Thank you so much
I tried #Niloct solution, unset VIMINIT and vim/neovim is backed to normal. After that, I reopen the iTerm and it showed error message again. Therefore I removed the export line from .zshrc and the problem has been solved.
To load a clean neovim:
nvim -u NONE -U NONE -N -i NONE
Actually I have an alias for that
alias vinone='nvim -u NONE -U NONE -N -i NONE'
This way you can type vinone and use your default neovim

bash_profile Powerline setup

I am learning the command line and trying to customize my environment to have Powerline functionality.
I have installed the Powerline file from GitHub and am trying to add to my path variable.
My .bash_profile is set as follows:
export PATH=$PATH:$HOME/Library/Python/2.7/bin
export PATH=$PATH:$HOME/Library/Python/2.7/binpowerline-daemon -qPOWERLINE_BASH_CONTINUATION=1POWERLINE_BASH_SELECT=1. /Users/johnmyers/Library/Python/2.7/lib/python/site-packages/powerline/bindings/bash/powerline.sh
I receive the following error messages when launching terminal.
-bash: export: `-qPOWERLINE_BASH_CONTINUATION=1POWERLINE_BASH_SELECT=1': not a valid
identifier
-bash: export: `/Users/johnmyers/Library/Python/2.7/lib/python/site-packages/powerline/bindings/bash/powerline.sh':
not a valid identifier
I would appreciate any guidance in the right direction on this issue. Thank you.
The stuff you added needs to be broken up on individual lines with newlines between them. I can only guess where the newlines are supposed to go, but something like
export PATH=$PATH:$HOME/Library/Python/2.7/bin
# No need to repeat this
# export PATH=$PATH:$HOME/Library/Python/2.7/bin
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
. /Users/johnmyers/Library/Python/2.7/lib/python/site-packages/powerline/bindings/bash/powerline.sh

MacOS Bash command line overlap

I am new to Bash and just set my own terminal theme. However, when I typed a long command, the command line overlapped in one line instead of wrapping into two. I looked up for solutions and solved the problem by making sure I added \[...\] when using non-printing characters in a bash prompt. Yet, when I move up and down my cursor on previous command line, the command line still overlaps like this:
katnano .bash_profile
while normally it should be:
katrinachan#katrina :~$ nano .bash_profile
My .bash_profile looks like this:
export PS1="\[\e[1;38;5;73m\u#\h\e[m\] :\[\e[1;38;5;214m\W\e[m\]\$ "
export CLICOLOR=1
export LSCOLORS=Cxfxcxdxbxegedabagacad
May I know what I am missing in my .bash_profile file? Thanks
[Solved]
Thank you! It works perfectly. Now my code is:
export PS1="[\e[1;38;5;73m]\u#\h[\e[m] :[\e[1;38;5;214m]\W[\e[m]\$ "
export CLICOLOR=1
export LSCOLORS=Cxfxcxdxbxegedabagacad
The overlap problem doesn't exist anymore.
The \[...\] should only bracket sequences which do not involve cursor movement on output. You have the \u#\h\e sequence inside these brackets where obviously it should be outside.

Basic command lines on Mac terminal not working

I changed the bash profile while trying to install mongodb and none of my command lines are working on terminal. I read online that I need to fix the $PATH but I can't even access it when none of my commands are working.
Help?
Mistakenly I also ran into same problem where to resolve this I had to reset my PATH variable to basic settings as below :
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin"
Once you set PATH variable now you can open the .bash_profile file in same terminal session only and make changes accordingly. This will resolve your problem.
Ok I found the answer from here:
"Open Terminal, and go to File (or Shell) -> New Command. Type in open -e .profile (or substitute some other file instead of .profile), and hit Run. That should open TextEdit with the file you want to fix; you can remove the offending lines there."
in my case i typed in nano .bash_profile and that allowed me to edit my bash profile and fix the issue.
can't use terminal from error in .bash_profile
Run this in terminal:
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

Unix commands not working on terminal

I'm not able to execute any unix commands on my Mac OS Terminal. I was adding a path to my Scala Installation Location.
You've broken your $PATH environment variable, by the looks of it in ~/.bash_profile.
To fix:
Start Terminal.app (with error message as you posted).
Manually set $PATH:
export PATH=/usr/bin:/bin
Edit your ~/.bash_profile:
vi ~/.bash_profile
Remove the ?? characters from the scala path. That looks like it might be an invisible character, so I would recommend deleting the line and retyping it.
Save and test.
It sounds like you've replaced your path, rather than appended the path to Scala. You'll now need to use the full path to commands and then you'll be able to restore the path.
You can call vi from /usr/bin/vim

Resources