无法通过 MacPorts 在 Mac 中更新我的 Bash

发布于 2024-07-18 05:13:20 字数 195 浏览 1 评论 0原文

我通过 MacPorts 将 Bash 更新到 3.2.48 失败。

看来我没有激活它,因为我得到了

echo $BASH_VERSION
3.2.17(1)-release

如何使最新的 Bash 处于活动状态,以便我可以将它用于我的登录 shell?

I updated unsuccessfully my Bash to 3.2.48 by MacPorts.

It seems that I do not have it active, since I get

echo $BASH_VERSION
3.2.17(1)-release

How can you make the newest Bash active such that I get it for my login shell?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

独自←快乐 2024-07-25 05:13:20

运行以下代码,例如将您的 shell 更改为 MacPorts 安装的最新 Bash

chsh -s /opt/local/bin/bash

如果您收到以下消息,

非标准 shell

您需要添加

/opt/local/bin/bash

/etc/shells

请注意,/etc/shells 只是一个文本文件,因此如果您以 root 身份进行身份验证,则可以直接编辑它。 您可以通过以下命令以编程方式更改它:

sudo -s
Password:
# echo /opt/local/bin/bash >> /etc/shells

如果您的第一个 chsh 命令失败,如果您设法更改了上述文件,请立即再次运行它。

Run the following code, for instance to change your shell to the newest Bash installed by MacPorts

chsh -s /opt/local/bin/bash

If that gives you the message,

"non-standard shell"

you will need to add

/opt/local/bin/bash

to

/etc/shells

Note that /etc/shells is just a text file, so you can edit it directly if you authenticate as root. You can programmatically change it by the command

sudo -s
Password:
# echo /opt/local/bin/bash >> /etc/shells

If your first chsh command failed, run it now again if you managed to change the above file.

梦里的微风 2024-07-25 05:13:20

我猜它已安装但未用作您的登录 shell。

您可以在命令行上使用 dscl 更改 shell。

在 dscl 提示符处键入以下内容:

list Local/Default/Users
read Local/Default/Users/<your username here>
change Local/Default/Users/<your username here> UserShell /bin/bash /opt/local/bin/bash

如果有帮助,我的 博客 上有另一个 dscl 使用示例。

I'm guessing it's installed but not being used as your login shell.

You can change the shell using dscl on the command line.

At the dscl prompt type the following:

list Local/Default/Users
read Local/Default/Users/<your username here>
change Local/Default/Users/<your username here> UserShell /bin/bash /opt/local/bin/bash

I have another example of dscl use on my blog if it helps.

樱桃奶球 2024-07-25 05:13:20

您可以将登录 shell 从现有的 Mac OS X 登录 shell(默认情况下,Mac OS X 附带的 /bin/bash)切换到 MacPorts /opt/local/bin/bash 只需使用以下 shell 脚本即可:

#!/opt/local/bin/bash
if [ `grep /opt/local/bin/bash /etc/shells` ]; 
then 
    echo /opt/local/bin/bash | chsh -s /opt/local/bin/bash;     
else 
    echo /opt/local/bin/bash | sudo tee -a /etc/shells; 
    chsh -s /opt/local/bin/bash; 
fi

You can switch your login shell, from your existing Mac OS X login shell (by default its /bin/bash shipped with Mac OS X), to MacPorts /opt/local/bin/bash just by using the following shell script:

#!/opt/local/bin/bash
if [ `grep /opt/local/bin/bash /etc/shells` ]; 
then 
    echo /opt/local/bin/bash | chsh -s /opt/local/bin/bash;     
else 
    echo /opt/local/bin/bash | sudo tee -a /etc/shells; 
    chsh -s /opt/local/bin/bash; 
fi
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文