bash broken osx“[进程完成]”

bash broken osx“[进程完成]”

我在运行“brew unlink bash”的脚本中遇到错误。然后我开始收到:Warning: bash already installed, it's just not linked

我试过

brew update && brew install bash
sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells'
chsh -s /usr/local/bin/bash `logname`

我尝试通过根据不同的答案/usr/local/bin/bash从中删除来修复它/etc/shells,但在退出终端之前忘记重新添加它。我无法再次编辑文件,因为我的终端根本不起作用:

login: /usr/local/bin/bash: No such file or directory

[Process completed]

按照有关如何临时修复终端的说明后,我仍然遇到问题:

cchilders:~ 
$ sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells'
Password:

cchilders:~ 
$ chsh -s /usr/local/bin/bash `logname`
Changing shell for cchilders.
Password for cchilders: 
chsh: WARNING: shell '/usr/local/bin/bash' does not exist

cchilders:~ 
$ brew update && brew install bash
Updated 2 taps (caskroom/cask, caskroom/versions).
No changes to formulae.
Warning: bash-4.4.12 already installed, it's just not linked.

如何在 osx 上恢复终端?谢谢

答案1

打开终端,然后选择 Shell → 新命令并运行/bin/bash

                 

答案2

基于https://apple.stackexchange.com/questions/230967/homebrew-wont-link-git,我跑了

brew doctor
# explained to link bash in the middle of output
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  bash

brew link bash

cchilders:~ 
$ echo $BASH_VERSION 
4.4.12(1)-release

相关内容