在新的Mac上安装Rails

时间:2014-03-26 12:17:10

标签: ruby-on-rails ruby macos terminal rvm

我正在尝试在新机器上设置Rails,并在尝试安装Ruby 1.9.3时遇到此错误。

$ rvm install 1.9.3 --with-gcc=clang
Checking requirements for osx.
Installing requirements for osx.
Updating system.....
Error running 'requirements_osx_brew_update_system ruby-1.9.3-p545',
showing last 15 lines of /Users/mitchelld/.rvm/log/1395835654_ruby-1.9.3-p545/update_system.log
https://github.com/mxcl/homebrew/wiki/Common-Issues
and make sure `brew update` works before continuing.'
++ 1395835655.N /scripts/functions/logging : rvm_error()  1 > rvm_pretty_print stderr
++ 1395835655.N /scripts/functions/logging : rvm_pretty_print()  73 > case "${rvm_pretty_print_flag:=auto}" in
++ 1395835655.N /scripts/functions/logging : rvm_pretty_print()  78 > case "${TERM:-dumb}" in
++ 1395835655.N /scripts/functions/logging : rvm_pretty_print()  81 > case "$1" in
++ 1395835655.N /scripts/functions/logging : rvm_pretty_print()  11 > [[ -t 2 ]]
++ 1395835655.N /scripts/functions/logging : rvm_pretty_print()  11 > return 1
++ 1395835655.N /scripts/functions/logging : rvm_error()  45 > printf %b 'Failed to update Homebrew, follow instructions here:
https://github.com/mxcl/homebrew/wiki/Common-Issues
and make sure `brew update` works before continuing.\n'
Failed to update Homebrew, follow instructions here:
https://github.com/mxcl/homebrew/wiki/Common-Issues
and make sure `brew update` works before continuing.
++ 1395835655.N /scripts/functions/requirements/osx_brew : requirements_osx_brew_update_system()  3return 1
Requirements installation failed with status: 1.

尝试在Ruby 2.0.0上安装Rails时出现此错误

$ sudo gem install rails
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for libkern/OSAtomic.h... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling atomic_reference.c
atomic_reference.c:57:59: warning: incompatible pointer types passing 'void **' to           parameter of type 'volatile int64_t *' (aka 'volatile long long *') [-Wincompatible-pointer-types]
if (OSAtomicCompareAndSwap64(expect_value, new_value, &DATA_PTR(self))) {
                                                      ^~~~~~~~~~~~~~~
/usr/include/libkern/OSAtomic.h:507:93: note: passing argument to parameter '__theValue' here
bool    OSAtomicCompareAndSwap64( int64_t __oldValue, int64_t __newValue, volatile int64_t *__theValue );
                                                                                        ^
1 warning generated.
linking shared-object atomic_reference.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-    argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [atomic_reference.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/atomic-1.1.16 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/atomic-1.1.16/gem_make.out

我已经尝试卸载Atomic gem并重新安装,我发现它是由XCode 5.1引起的。

1 个答案:

答案 0 :(得分:0)

正如错误消息所示,

  • 在继续
  • 之前确保brew update有效
  • 之后,没有其他标志的普通rvm install 1.9.3应该可以正常工作
  • 使用RVM,不要将sudogem命令一起使用,因为它将使用系统RubyGems
  • 只是gem install rails现在也应该工作
  • 如果您想使用Ruby系统,那么Mavericks就会出现问题。您可以在此处找到解决方案:New Rails Project: 'bundle install' can't install rails in gemfile