I am changing over from oh-my-zsh to prezto. And now have run into the following error every time I open a terminal window:
/Users/jasenlew/.zshenv:7: command not found: ^M
/Users/jasenlew/.zshenv:13: parse error near `\n'
/Users/jasenlew/.zprofile:7: command not found: ^M
/Users/jasenlew/.zprofile:11: command not found: ^M
/Users/jasenlew/.zprofile:80: parse error near `\n'
/Users/jasenlew/.zshrc:7: command not found: ^M
/Users/jasenlew/.zshrc:15: parse error near `\n'
/Users/jasenlew/.zlogin:7: command not found: ^M
/Users/jasenlew/.zlogin:15: command not found: ^M
/Users/jasenlew/.zlogin:9: command not found: ^M
/Users/jasenlew/.zlogin:12: command not found: then^M
/Users/jasenlew/.zlogin:16: command not found: ^M
/Users/jasenlew/.zlogin:21: parse error near `\n'
/Users/jasenlew/.zlogin:zcompile:13: can't open file: /Users/jasenlew/.zcompdump^M^M
/Users/jasenlew/.zlogin:14: command not found: fi^M
I have already removed oh-my-zsh, and have installed prezto per the repo/instructions here: https://github.com/hackreactor-labs/prezto.
I did some Googling and try some solutions, none which have worked, including, changing a line in my .gitconfig file from "autocrlf = true" to "autocrlf = false".
I found something (was confusing to me) about the character line spacing not being processed correctly, but did not understand it completely, and directions to resolve were murky.
Thanks again for the help!
Your /Users/jasenlew/.z*
files have Windows-style line endings, which zsh doesn't recognize.
Windows-style text files have their line endings marked with a CR-LF pair; CR (carriage return) is often represented as ^M
(Ctrl-M).
UNIX style text files have their line endings marked with just an LF (linefeed) character.
zsh assumes UNIX-style line endings, and treats the CR-LF pair as a ^M
character at the end of the line.
You just have to remove the Windows-style line endings.
If you have dos2unix
installed, you can use that. Be sure to read the man page; unlike most text filters, it replaces its input file by default.
Or you can use tr
, for example:
tr -d '\r' < filename > filename.tmp
# check filename.tmp to make sure it's correct
mv filename.tmp filename
You can also use the file
command to determine what kind of file you have. It's not 100% reliable, but it will probably report what kind of line endings a given file has.
Once you've fixed the line endings, you can check the files back into your Git repository and then make sure they're still ok.
(You might also want to tweak your .gitconfig
settings. The default settings should be ok. I don't know the details off the top of my head.)