如何在 Mac OS X 10.5.8 上安装 Bash >= 3.2.25?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10574969/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 22:05:10  来源:igfitidea点击:

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

bashrvmosx-leopard

提问by kadolor

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

我正在关注 Michael Hartl 的 Rails 教程,到目前为止我已经安装了 Git 1.7.5.4 x86_64(我正在运行 OSX 10.5.8)并且我正在尝试安装 rvm

After I run the following:

在我运行以下命令后:

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

$ 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/bashbut I get shell '/opt/local/bin/bash' does not exist

我试过改变外壳,使用chsh -s /opt/local/bin/bash但我得到shell '/opt/local/bin/bash' does not exist

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

不知道从哪里开始,但我很感激任何指导。谢谢!

回答by jeffbyrnes

Homebrew is generally a bit nicer than MacPorts, as it doesn't require lots of sudoaction. 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

Homebrew 通常比 MacPorts 好一点,因为它不需要很多sudo操作。这是一篇指导我升级 bash 安装的文章:http: //concisionandconcinnity.blogspot.com/2009/03/upgrade-bash-to-40-in-mac-os-x.html

As for steps:

至于步骤:

  1. Install Homebrewfrom 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 bashto 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 bashsitting 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
    
  1. 从主页上的文档安装Homebrew
  2. 使用 Homebrew 安装 Git(可选,但很高兴有更新的git

    brew install git
    
  3. 现在安装bash

    brew install bash
    
  4. 将此安装添加bash到允许的 shell 列表中:

    echo '/usr/local/bin/bash' | sudo tee -a /etc/shells;
    
    • Homebrew/usr/local/Cellar/默认情况下会安装东西,然后将任何二进制文件符号链接到/usr/local/bin,所以你现在有最新的bash坐在/usr/local/bin/bash
  5. 最后,更改您的外壳以使用这个新外壳:

    chsh -s /usr/local/bin/bash
    
  6. 打开一个新的终端窗口/选项卡,然后运行这些命令来仔细检查您的工作:

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

回答by Dave Everitt

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 perfectand it took almost an hour, but it got me Ruby 1.9.3 on 10.5.8.

mpapis 的说明很棒,但是当我尝试它们时并没有完全涵盖所有问题,所以这就是我必须做的。每次我在旧系统上安装 RVM 都是一次真正的尝试。下面的内容远非完美,花了将近一个小时,但它让我在 10.5.8 上获得了 Ruby 1.9.3。

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 pkghas been deprecated, so enter rvm help autolibsto read more…
  4. …you may prefer something else to MacPorts, but after letting rvm pkg install zlibdo 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 willfinish.
  6. During these processor-intensive installs your computer's fan will probably spin up to maximum speed for some time :-)
  1. RVM 设计为在您的用户帐户下运行,sudo而不是以 root 身份运行,因此输入这些命令时不使用sudo,如图所示。
  2. 注意到 mpapis 的警告,我发现 Ruby-1.9.3-p448 可以与 10.5.8 附带的 gcc 版本 4.0.1 一起使用,但其他 Ruby 可能不会。
  3. 一些库 Ruby 需要启动 MacPorts 的安装,例如,如果这样做:rvm pkg install zlib,但pkg已被弃用,因此请输入rvm help autolibs以阅读更多...
  4. ……与 MacPorts 相比,您可能更喜欢其他东西,但是在让rvm pkg install zlib我放弃之后,我的 RVM 安装的 Ruby 很好地使用了它。
  5. 安装 Ruby 可能需要很长时间,而且似乎什么都不做(您可能会看到Installing required packages: autoconf, automake, [etc.] gdbm, ncurses........后面出现更慢的 行..........),但它完成。
  6. 在这些处理器密集型安装期间,您的计算机风扇可能会在一段时间内达到最大速度:-)

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

获取 rvm-install 脚本(k选项绕过 SSL 警告):

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

Prevent the BASH version check

防止 BASH 版本检查

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).

手动注释掉bash“rvm-installer”脚本中检查您的版本(第 3-11 行)的行(原因:OS X 10.5.8 具有 BASH 3.2.17 并且脚本警告:BASH 3.2.25 required (you have 3.2.17(1)-release).

Run the installer

运行安装程序

Make sure the rvm-installer script is executable:

确保 rvm-installer 脚本是可执行的:

chmod +x rvm-installer

Just run the script as below to get RVM (the suggested command /rvm-installer -s stablemight only bring up the Usagedocument):

只需运行如下脚本即可获取 RVM(建议的命令/rvm-installer -s stable可能只会显示Usage文档):

./rvm-installer

You should then see:

然后你应该看到:

Downloading RVM from wayneeseguin branch master

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

如果你得到SSL certificate problem,允许curl进行“不安全”下载,然后再次运行脚本:

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

Start using RVM and install Ruby

开始使用 RVM 并安装 Ruby

To start using RVM right away enter:

要立即开始使用 RVM,请输入:

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:

要安装 Ruby 1.9.3(标准 10.5 库的最安全选项),您现在应该能够输入:

rvm install 1.9.3

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

(这里的过程很长——见上面的第 5 点)。然后要使用新的 Ruby,请输入:

rvm use 1.9.3

回答by Todd A. Jacobs

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

您需要一种方法来安装正确版本的 Bash。一种方法是:

  1. Install MacPorts
  2. Install the Bash port with sudo port install bash
  3. Change your shellto use the new version of Bash
  1. 安装 MacPorts
  2. 安装 Bash 端口 sudo port install bash
  3. 更改 shell以使用新版本的 Bash

回答by mpapis

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

您可以通过删除对 bash 版本的检查来运行安装程序。

Install RVM

安装 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.

请务必阅读rvm requirements,我建议您安装支持的 osx-installer 或 Xcode gcc-4.2- GNU GCC 而不是 LLVM GCC,只有 Ruby 1.9.3-p194 与 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.logwill be created, please open a ticket for RVMwith the results - if it worked well I will downgrade the check - if not, fixes should be made before downgrading the check.

test.log将创建文件,请打开带有结果的RVM 票证- 如果它运行良好,我将降级支票 - 如果没有,则应在降级支票之前进行修复。

回答by 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 CodeGnomestated.

您使用的是 Power PC Mac 吗?如果您使用的是英特尔 PC,何不升级到 Lion。Lion 附带 BASH 3.2.48。否则,您将不得不像CodeGnome所说的那样尝试使用 MacPorts 。