How do I install Bash >= 3.2.25 on Mac OS X 10.5.8?

ε祈祈猫儿з 提交于 2019-11-28 19:22:22

Homebrew is generally a bit nicer than MacPorts, as it doesn't require lots of sudo action. Here's an article that guided me to upgrading my install of bash: http://concisionandconcinnity.blogspot.com/2009/03/upgrade-bash-to-40-in-mac-os-x.html

As for steps:

  1. Install Homebrew from the docs on their homepage
  2. Install Git using Homebrew (optional, but nice to have a more up-to-date git)

    brew install git
    
  3. Now install bash:

    brew install bash
    
  4. Add this install of bash to the allowed shells list:

    echo '/usr/local/bin/bash' | sudo tee -a /etc/shells;
    
    • Homebrew installs things to /usr/local/Cellar/ by default, then symlinks any binaries to /usr/local/bin, so you've now got the latest bash sitting at /usr/local/bin/bash
  5. Finally, change your shell to use this new one:

    chsh -s /usr/local/bin/bash
    
  6. Open a new terminal window/tab, and run these commands to double-check your work:

    $ echo $SHELL
    /usr/local/bin/bash
    $ echo $BASH_VERSION
    4.2.37(2)-release
    

mpapis' instructions are great, but didn't completely cover all the issues when I tried them, so this is what I had to do. Every time I install RVM on a legacy system it's a real trial. The below is far from perfect and it took almost an hour, but it got me Ruby 1.9.3 on 10.5.8.

The big picture (stuff that isn't always explained):

  1. RVM is designed to run under your user account, NOT as root with sudo, so these commands are to be entered without sudo, just as shown.
  2. Heeding mpapis' warning, I found that Ruby-1.9.3-p448 will work with gcc version 4.0.1 which comes with 10.5.8, but other Rubies may not.
  3. Some libraries Ruby requires initiate an install of MacPorts, e.g. if done like this: rvm pkg install zlib, but pkg has been deprecated, so enter rvm help autolibs to read more…
  4. …you may prefer something else to MacPorts, but after letting rvm pkg install zlib do its thing I gave in and later, my RVM install of Ruby used it nicely.
  5. Installing Ruby may take a very long time and appear to be doing nothing (you might see Installing required packages: autoconf, automake, [etc.] gdbm, ncurses........ followed by even more very slowly-appearing lines of ..........), but it will finish.
  6. During these processor-intensive installs your computer's fan will probably spin up to maximum speed for some time :-)

Get the rvm-install script (the k option by-passes SSL warnings):

curl -Lk get.rvm.io -o rvm-installer

Prevent the BASH version check

Manually comment out the lines that check your version of bash (lines 3-11) in the 'rvm-installer' script (reason: OS X 10.5.8 has BASH 3.2.17 and the script warns: BASH 3.2.25 required (you have 3.2.17(1)-release).

Run the installer

Make sure the rvm-installer script is executable:

chmod +x rvm-installer

Just run the script as below to get RVM (the suggested command /rvm-installer -s stable might only bring up the Usage document):

./rvm-installer

You should then see:

Downloading RVM from wayneeseguin branch master

if you get SSL certificate problem, allow curl to do an 'insecure' download then run the script again:

echo insecure >> ~/.curlrc
./rvm-installer

Start using RVM and install Ruby

To start using RVM right away enter:

source /Users/your_user_name/.rvm/scripts/rvm

To install Ruby 1.9.3 (safest option with standard 10.5 libraries) you should now be able to enter:

rvm install 1.9.3

(long process here - see point 5 above). Then to use your new Ruby, enter:

rvm use 1.9.3
Todd A. Jacobs

You need a way to install the correct version of Bash. One way is:

  1. Install MacPorts
  2. Install the Bash port with sudo port install bash
  3. Change your shell to use the new version of Bash

You could run the installer by removing the check for bash version.

Install RVM

curl -L get.rvm.io -o rvm-installer # Download
sed -i"" '2,9 d' rvm-installer      # Remove the check
chmod +x rvm-installer              # Allow executing the script
./rvm-installer -s stable           # Run installer

Make sure to read rvm requirements, I advice you to install osx-installer or Xcode which supports gcc-4.2 - a GNU GCC not LLVM GCC, only Ruby 1.9.3-p194 is working good with LLVM.

Install Rubies

rvm pkg install zlib
rvm pkg install openssl
rvm pkg install libyaml
rvm install 1.8.7
rvm install 1.9.2
rvm install 1.9.3

Test

git clone https://github.com/wayneeseguin/rvm-test.git
cd rvm-test
gem install dtf
dtf --text rvm-test/fast/* 2>&1 | tee test.log

File test.log will be created, please open a ticket for RVM with the results - if it worked well I will downgrade the check - if not, fixes should be made before downgrading the check.

David W.

Are you on a Power PC Mac? If you're on an Intel PC, why not upgrade to Lion. Lion comes with BASH 3.2.48. Otherwise, you'll have to try using MacPorts as CodeGnome stated.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!