Tuesday, October 9, 2012

update bash version on Mac

用到今天我才發現原來 Mac 上面 default 的 bash 竟然是骨灰級的版本

$ bash --version
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)
Copyright (C) 2007 Free Software Foundation, Inc.


更新步驟

$ brew install bash

$ /usr/local/bin/bash --version
GNU bash, version 4.2.37(2)-release (i386-apple-darwin12.2.0)
Copyright (C) 2011 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.


# 在最後加上裝好的 bash 新版
sudo vim /private/etc/shells
/usr/local/bin/bash

# 換過來
chsh -s /usr/local/bin/bash

$ echo $SHELL
/usr/local/bin/bash

$ echo $BASH_VERSION
4.2.37(2)-release


done.

No comments:

Post a Comment