如何在 Mac OS x 10.8.x 上安装 rvm。rvm:安装 rvm 后未找到命令

如何在 Mac OS x 10.8.x 上安装 rvm。rvm:安装 rvm 后未找到命令

我下载了 Mac OSx 的命令行工具。检查了 git 版本。然后尝试安装 rvm:

MacBook-Pro:~ Tom$ curl -L https://get.rvm.io | bash -s stable
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   185  100   185    0     0     97      0  0:00:01  0:00:01 --:--:--   106
100 10648  100 10648    0     0   4164      0  0:00:02  0:00:02 --:--:--  118k
Downloading RVM from wayneeseguin branch stable
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   131  100   131    0     0    209      0 --:--:-- --:--:-- --:--:--   524
100 1488k  100 1488k    0     0   820k      0  0:00:01  0:00:01 --:--:-- 1578k

Installing RVM to /Users/Tom/.rvm/
    Adding rvm PATH line to /Users/Tom/.bashrc /Users/Tom/.zshrc.
    Adding rvm loading line to /Users/Tom/.bash_profile /Users/Tom/.zprofile.

# RVM:  Shell scripts enabling management of multiple ruby environments.
# RTFM: https://rvm.io/
# HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
# Cheatsheet: http://cheat.errtheblog.com/s/rvm/
# Screencast: http://screencasts.org/episodes/how-to-use-rvm

# In case of any issues read output of 'rvm requirements' and/or 'rvm notes'

Installation of RVM in /Users/Tom/.rvm/ is almost complete:

  * To start using RVM you need to run `source /Users/Tom/.rvm/scripts/rvm`
    in all your open shell windows, in rare cases you need to reopen all shell windows.

# Tom,
#
#   Thank you for using RVM!
#   I sincerely hope that RVM helps to make your life easier and
#   more enjoyable!!!
#
# ~Wayne

我尝试使用 rvm 命令检查版本rvm --version,但找不到该命令。然后我运行dvm source /Users/Tom/.rvm/scripts/rvm,下次使用时显示的版本rvm --version运行正常。一切似乎都很好。但随后我尝试安装 ruby​​ 1.9.3

Thomass-MacBook-Pro:~ Tom$ rvm install 1.9.3
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p374.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Fetching yaml-0.1.4.tar.gz to /Users/Tom/.rvm/archives
######################################################################## 100.0%
Extracting yaml to /Users/Tom/.rvm/src/yaml-0.1.4
Configuring yaml in /Users/Tom/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/Tom/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/Tom/.rvm/usr
Installing Ruby from source to: /Users/Tom/.rvm/rubies/ruby-1.9.3-p374, this may take a while depending on your cpu(s)...
ruby-1.9.3-p374 - #downloading ruby-1.9.3-p374, this may take a while depending on your connection...
######################################################################## 100.0%
ruby-1.9.3-p374 - #extracting ruby-1.9.3-p374 to /Users/Tom/.rvm/src/ruby-1.9.3-p374
ruby-1.9.3-p374 - #extracted to /Users/Tom/.rvm/src/ruby-1.9.3-p374
ruby-1.9.3-p374 - #configuring
ruby-1.9.3-p374 - #compiling
Error running 'make', please read /Users/Tom/.rvm/log/ruby-1.9.3-p374/make.log
There has been an error while running make. Halting the installation.

这是make.log的内容:

`

Thomass-MacBook-Pro:~ Tom$ vim /Users/Tom/.rvm/log/ruby-1.9.3-p374/make.log

[2013-02-01 17:44:00] make
        CC = clang
        LD = ld
        LDSHARED = clang -dynamic -bundle
        CFLAGS = -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration  -pipe
        XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
        CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -I/Users/Tom/.rvm/usr/include -I. -I.ext/include/x86_64-darwin12.2.1 -I./include -I.
        DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace
        SOLIBS =
compiling regparse.c
regparse.c:582:15: error: implicit conversion loses integer precision: 'st_index_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
    return t->num_entries;
    ~~~~~~ ~~~^~~~~~~~~~~
1 error generated.
make: *** [regparse.o] Error 1
~                                                                               
"~/.rvm/log/ruby-1.9.3-p374/make.log" 15L, 954C

答案1

使用 homebrew 安装 GCC 4.2 并重试。这对我有用。

brew update
brew tap homebrew/dupes
brew install apple-gcc42

也可以看看:

相关内容