How to make zsh run as a login shell on Mac OS X (in iTerm)?

前端 未结 6 2411
闹比i
闹比i 2020-12-22 16:23

When zsh is set as a login shell on Mac OS X, when it is started by iTerm, zsh doesn\'t consider that it\'s being run as a login shell, although it\'s started as ‘-zsh’ (‘-’

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-22 17:07

    The command to change the shell at startup is chsh -s . The default shells in mac OS X are installed inside the bin directory so if you want to change to the default zsh then you would use the following

    chsh -s /bin/zsh
    

    If you're using different version of zsh then you might have to add that version to /etc/shells to avoid the nonstandard shell message. For example if you want home-brew's version of zsh then you have to add /usr/local/bin/zsh to the aforementioned file which you can do in one command sudo sh -c "echo '/usr/local/bin/zsh' >> /etc/shells" and then run

    chsh -s /usr/local/bin/zsh
    

    Or if you want to do the whole thing in one command just copy and paste this if you have zsh already installed

    sudo sh -c "echo '/usr/local/bin/zsh' >> /etc/shells" && chsh -s /usr/local/bin/zsh
    

提交回复
热议问题