35

I'm following Michael Hartl's Rails tutorial, so far I've installed Git 1.7.5.4 x86_64 (I'm running OSX 10.5.8) and I'm trying to install rvm

After I run the following:

$ curl -kL get.rvm.io | bash -s stable

I get:

BASH 3.2.25 required (you have 3.2.17(1)-release)

I've tried changing the shell, using chsh -s /opt/local/bin/bash but I get shell '/opt/local/bin/bash' does not exist

Not sure where to go from here but I'd appreciate any guidance. Thanks!

Perception
  • 79,279
  • 19
  • 185
  • 195
kadolor
  • 351
  • 1
  • 3
  • 3
  • What distro are you using? What steps have you taken to install the required version of Bash? – Todd A. Jacobs May 13 '12 at 20:34
  • Sorry for the novice question, but how would I check my distro? I'm on a Mac, running OSX 10.5.8, I've tried to follow the instructions here: http://stackoverflow.com/questions/791227/unable-to-update-my-bash-in-mac-by-macports (haven't installed MacPorts). After following those commands my terminal read '3.2.#' but nothing came after it. – kadolor May 13 '12 at 21:07
  • 1
    Mac OS X doesn't have distros like Linux (which I'm assuming CodeGnome thought you were running). – echristopherson May 13 '12 at 23:57
  • @kadolor would you mind accepting my answer if it helped you out? It seems to have received the most love from others, too. – jeffbyrnes Jan 24 '18 at 19:47

5 Answers5

82

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
    
jeffbyrnes
  • 2,182
  • 2
  • 22
  • 33
4

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
Community
  • 1
  • 1
Todd A. Jacobs
  • 81,402
  • 15
  • 141
  • 199
4

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
Dave Everitt
  • 17,193
  • 6
  • 67
  • 97
1

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.

mpapis
  • 52,729
  • 14
  • 121
  • 158
  • I need a quick temporary install on OS X 10.5, so tried the above. First, `curl` complains of certificates so I added the -k flag: `curl -Lk get.rvm.io -o rvm-installer`, then... `sed: -i may not be used with stdin` so I manually commented out the bash check, but now there appears to be no `-s` option for the installer - `./rvm-installer -s stable` brings up 'Usage', showing just `--version`, `--branch` and `--trace` as options? – Dave Everitt Aug 05 '13 at 21:17
  • Finally, after doing `echo insecure >> ~/.curlrc` I ran ``./rvm-installer`. But after warning `Beware, 'rvm pkg ...' is deprecated,` `rvm pkg install zlib` went right ahead and installed macports, which I really didn't want and had removed a few months ago! – Dave Everitt Aug 05 '13 at 21:28
  • 1
    if `rvm pkg install zlib` installed `port` - then it's a bug, but anyway you need to read on [autolibs](http://rvm.io/rvm/autolibs) it is superior over `rvm pkg` and will install all requirements for ruby (using macports / homebrew ... or any other recognized and available package manager – mpapis Aug 06 '13 at 01:07
  • Thanks - read the autolibs info but already had MacPorts installed 'for me' by running `rvm pkg install zlib` - which was a surprise! And, as you say, probably a bug or by-product of something else. Wrote up the whole experience below, in case it helps someone else in this position. BTW this was to run the latest version of nanoc. – Dave Everitt Aug 06 '13 at 21:25
-1

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.

Community
  • 1
  • 1
David W.
  • 105,218
  • 39
  • 216
  • 337