如何在 Mac OSX Mountain Lion 中升级 Bash 并将其设置为正确的路径?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16416195/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I upgrade Bash in Mac OSX Mountain Lion and set it the correct path?
提问by Tom
since Mountain Lion still uses the old bash 3.x, I was wondering if there is a good tutorial (or if somebody could post one here) on how to upgrade bash to the latest version. Also, it would be helpful to know how to set the path so that it can be used in terminal.
由于 Mountain Lion 仍然使用旧的 bash 3.x,我想知道是否有关于如何将 bash 升级到最新版本的好教程(或者是否有人可以在此处发布)。此外,了解如何设置路径以便在终端中使用它会很有帮助。
Thanks in advance
提前致谢
回答by k107
- Update brew:
brew update - Install bash with
brew install bash - Add
/usr/local/bin/bashto/etc/shells - Change the default shell with
chsh -s /usr/local/bin/bash
- 更新酿造:
brew update - 安装 bash
brew install bash - 添加
/usr/local/bin/bash到/etc/shells - 更改默认外壳
chsh -s /usr/local/bin/bash
You don't normally have to change any settings in Terminal or iTerm 2. Both of them default to opening new shells with the default login shell.
您通常不必更改终端或 iTerm 2 中的任何设置。它们都默认使用默认登录外壳打开新外壳。

