我正在尝试更新sdman
我的 macOS 中的软件,但我收到 bash outadted 版本错误。
rajkumar.natarajan$ sdk update
An outdated version of bash was detected on your system!
We recommend upgrading to bash 4.x, you have:
3.2.57(1)-release
Need to use brute force to replace candidates...
Run Code Online (Sandbox Code Playgroud)
但是 bash 版本已经是最新的了。
rajkumar.natarajan$ which bash
/usr/local/bin/bash
rajkumar.natarajan$ bash --version
GNU bash, version 5.0.11(1)-release (x86_64-apple-darwin16.7.0)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Run Code Online (Sandbox Code Playgroud)
jes*_*e_b 10
sdman
正在查看/bin/bash
哪个是 3.2.57 版本,因为 macos 不能提供比它更新的任何东西。
Apple 在其操作系统中包含如此旧版本的 Bash 的原因与许可有关。从 4.0 版(3.2 的后继版本)开始,Bash 使用 Apple 不(想要)支持的 GNU 通用公共许可证 v3 (GPLv3)。你可以在这里和这里找到一些关于这个的讨论。GNU Bash 3.2 版是 GPLv2 的最后一个版本,Apple 接受了它,因此它坚持使用它。
您已经安装了现代版本的 bash,但您还没有更换/bin/bash
它。我真的不建议这样做,因为它可能会破坏一些遗留脚本/程序(不太可能但可能)。
我的建议是忽略该警告。这是警告你,因为 bash v3.2 通常会受到shellshock漏洞的影响,但是 Apple 已经在他们的 Bash v3.2 版本中修补了这个漏洞。
如果您无法忽略该警告并且真的想冒险更新您的/bin/bash
我会将其移动到备份位置并将您的新 bash 符号链接到它。
sudo mv /bin/bash /bin/bash.bak
sudo ln -s /usr/local/bin/bash /bin/bash
Run Code Online (Sandbox Code Playgroud)
但是为了做到这一点,您需要绕过 SIP
要启用或禁用系统完整性保护,您必须引导至恢复操作系统并从终端运行 csrutil(1) 命令。
$ csrutil disable