I'm using a Mac with OS X Yosemite and Zsh. By accident,I delete the content of three files below: .bashrc .bash_profile .profile After that ,when I open my terminal. The Zsh will show fail under the last login information,it confused me ,and I want to know why.
- 
                    What do you mean by "fail"? – svlasov Mar 26 '15 at 18:38
- 
                    the "fail" is a word below the last login information. It just like you entered a wrong command. – helloworld Mar 26 '15 at 23:49
2 Answers
You might want to look at a duplicate question: Zshell starts up with exit status of 1 after uninstalling RVM
It has an answer that solved the issue for me:
I found a .zlogin file on my system that contained some rvm-related code. I've deleted the code, and the problem is solved!
 
    
    - 2,214
- 2
- 17
- 20
Zsh (by default) doesn't read from .bashrc, .bash_profile, or .profile, so the contents of these files shouldn't matter. You also didn't mention which .bashrc, .bash_profile, and .profile were erased… These files exist in both your /Users/username directory and /etc. The files sourced by zsh at startup are listed in the OS X zsh man page (man zsh in a terminal) under "STARTUP/SHUTDOWN FILES". The only reason it would call one of the previously mentioned files is if they were explicitly sourced in one of the default files. 
My suggestions:
- Check the contents of - /etc/zshenv(this is the only zsh-specific file in my- etcdirectory). Mine has only the following:- # system-wide environment settings for zsh(1) if [ -x /usr/libexec/path_helper ]; then eval `/usr/libexec/path_helper -s` fi
- Can you log in at all using zsh? If not, can you log in using another shell? You can do this in the OS X Terminal.app by going to Preferences -> General and changing the option for "Shells open with:" from "Default login shell" to Command (fill in another shell, i.e., - /bin/bashor- /bin/sh). If you can log in with any shell, try the following solution from this question:- Looking for the error- All shell output goes to the terminal, so you could just redirect it when starting it. As you are looking for error messages during initialisation, I'd suggest the following procedure: - Disable the problematic configurations
- Open a terminal
- Check the value of SHLVL:echo $SHLVL
- Re-enable the configurations
- Start a new z-shell from within the running shell with zsh 2> zsh-error.log, this redirects stderr to the file 'zsh-error.log'.
- Check the value of SHLVLagain. If it is bigger then previous value then exit the current shell (exit). (Explanation below)
- Have a look at 'zsh-error.log' in the current directory.
 - If 'zsh-error.log' does not show anything, you may want to run - zsh -x 2> zsh-error.login step 5 instead. This provides a complete debug output of anything zsh does. This can get quite huge.- As the answer suggests, those logs can get enormous if you are sourcing man files at startup. Just a bare shell should result in a reasonably small log file. 
- Finally, you can retrieve a list of all the files sourced by zsh on startup by running - zsh -o sourcetrace.
Hope this helps.
 
    
    - 1
- 1
 
    
    - 314
- 2
- 14
