I am trying to install oh-my-zsh on Ubuntu 15. After running the installation script
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
I have the following error which never occur before
/home/li-xinyang/.zshrc:3: command not found: ^M
/home/li-xinyang/.zshrc:9: command not found: ^M
/home/li-xinyang/.zshrc:12: command not found: ^M
/home/li-xinyang/.zshrc:16: command not found: ^M
/home/li-xinyang/.zshrc:19: command not found: ^M
/home/li-xinyang/.zshrc:22: command not found: ^M
/home/li-xinyang/.zshrc:25: command not found: ^M
/home/li-xinyang/.zshrc:28: command not found: ^M
/home/li-xinyang/.zshrc:31: command not found: ^M
/home/li-xinyang/.zshrc:34: command not found: ^M
/home/li-xinyang/.zshrc:39: command not found: ^M
/home/li-xinyang/.zshrc:44: command not found: ^M
/home/li-xinyang/.zshrc:47: command not found: ^M
/home/li-xinyang/.zshrc:52: command not found: ^M
/home/li-xinyang/.zshrc:53: command not found: ^M
/home/li-xinyang/.zshrc:55: command not found: ^M
/home/li-xinyang/.zshrc:58: command not found: ^M
/home/li-xinyang/.zshrc:source:59: no such file or directory: /home/li-xinyang/.oh-my-zsh/oh-my-zsh.sh^M
/home/li-xinyang/.zshrc:60: command not found: ^M
/home/li-xinyang/.zshrc:63: command not found: ^M
/home/li-xinyang/.zshrc:70: command not found: ^M
/home/li-xinyang/.zshrc:73: command not found: ^M
/home/li-xinyang/.zshrc:76: command not found: ^M
How can I remove ^M
?
In my Mac ran dos2unix for all files installed by Oh-My-Zsh. In summary it was something like below. I kept rerunning source ~/.zshrc to check if the installation was OK, without any errors, until I have converted all files, including binary files.
brew install dos2unix
cd /Users/<your user>/.oh-my-zsh
find . -name " *.sh" | xargs dos2unix -f
find . -name " *.zsh" | xargs dos2unix -f
dos2unix -f themes/robbyrussel.zsh-theme
cd
dos2unix -f .zshrc
source ~/.zshrc
The solution is to set autocrlf=true
to autocrlf=false
use the command below,
git config --global core.autocrlf true
^M
is carriage return (CR), Windows-style text line ending make.
I could resolve this error in Ubuntu by saving the file ~/.zshrc
in LF mode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With