首页 > 上网技巧 > 电脑小技巧 > Mac升级bash到4版本

Mac升级bash到4版本

时间:2018-10-02 14:19 作者:QQ地带 我要评论

 
[lookback@LookBack-MBP ~]$ /bin/bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17)
Copyright (C) 2007 Free Software Foundation, Inc.
[lookback@LookBack-MBP ~]$
 
# 安装brew
[lookback@LookBack-MBP ~]$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# 安装bash
[lookback@LookBack-MBP ~]$ brew install bash
#替换bash
[lookback@LookBack-MBP ~]$ sudo mv /bin/bash /bin/bash.origin
[lookback@LookBack-MBP ~]$ sudo ln -s /usr/local/opt/bash/bin/bash /bin/bash
# 由于本mac版本下的sh并不是直接链接bash,而是bash的一个文件拷贝。因此,还要替换默认的sh指向的命令为bash,如下:
[lookback@LookBack-MBP ~]$ sudo mv /bin/sh /bin/sh.origin
[lookback@LookBack-MBP ~]$ sudo ln -s /usr/local/opt/bash/bin/bash /bin/sh
2. 验证 通过bash和sh命令查看版本:
 
 
[lookback@LookBack-MBP ~]$ bash --version
GNU bash,版本 4.4.23(1)-release (x86_64-apple-darwin17.5.0)
Copyright (C) 2016 Free Software Foundation, Inc.
许可证 GPLv3+: GNU GPL 许可证第三版或者更新版本 <http://gnu.org/licenses/gpl.html>
 
 

标签: Mac
顶一下
(0)
0%
踩一下
(0)
0%

Google提供的广告