macOS 升级 bash 到最新版本

macOS 的默认「终端」,千年不变的版本。

复制代码
》〉bash --version
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin24)
Copyright (C) 2007 Free Software Foundation, Inc.

官方 bash.git - bash 已经将 bash 升级到了 5.2的大版本。

macOS 最新版系统的 bash 默认是 2007年的版本。

升级bash

第一步

brew install bash

bash --- Homebrew Formulae

The GNU Bourne-Again Shell 这里。

第二步

which -a bash

$ / bin/bash

$ / usr/local/bin/bash // brew 安装的版本,最新版本的位置

第三步

chsh -s /usr/local/bin/bash

这只会变更当前用户的版本。

复制代码
>>bash --version
GNU bash,版本 5.2.37(1)-release (x86_64-apple-darwin23.4.0)
Copyright (C) 2022 自由软件基金会
许可证 GPLv3+:GNU GPL 许可证第三版或者更新版本 <http://gnu.org/licenses/gpl.html>

本软件是自由软件,您可以自由地更改和重新发布。
在法律许可的情况下特此明示,本软件不提供任何担保。

或者

sudo chsh -s /usr/local/bin/bash

如果考虑 root 也变更,

which -s bash

/usr/local/bin/bash -> /usr/local/Cellar/bash/5.2.37/bin/bash

相关推荐
pe7er3 天前
macOS 应用无法打开(权限问题)解决方案
macos·mac
harmful_sheep5 天前
mac生效的终端查看
macos
iOS门童6 天前
macOS 应用"已损坏"无法打开?一文搞懂 Gatekeeper 与解决方案
macos
NPE~6 天前
[工具分享]Maccy —— 优雅的 macOS 剪贴板历史管理工具
macos·教程·工具·实用工具
差不多程序员6 天前
Mac安装OpenClaw-cn保姆级教程
macos
dzl843946 天前
mac 安装python
开发语言·python·macos
Bruce_Liuxiaowei6 天前
在 macOS 上通过 Docker 本地安装 OpenClaw 完整教程
macos·docker·容器·openclaw
阿捏利6 天前
详解Mach-O(十五)Mach-O __DATA_CONST
macos·ios·c/c++·mach-o
ShikiSuen6 天前
macOS 的 CpLk 中英切换卡顿的元凶在 InputMethodKit 本身
macos
xiayutian_c6 天前
如虎添翼-MacOS
macos