ruby-on-rails - 在 Mac OS Mavericks 中安装 ruby​​ 1.9.3

标签 ruby-on-rails ruby macos rvm homebrew

我在 macports 上尝试了以下操作,但放弃并卸载了(http://guide.macports.org/chunked/installing.macports.uninstalling.html)它,因为我在 gcc42 库上失败并尝试了 Homebrew。

一切都(几乎)顺利,我不得不手动删除一些我用 macports 安装的库文件,Homebrew 很温和,告诉我具体该怎么做。我已经安装了 xcode,但我重新安装了它,以防万一。

然后我尝试使用以下方法安装 ruby​​ 1.9.3:

\curl -L https://get.rvm.io | bash -s stable --ruby=1.9.3

我收到了这个错误:

ruby-1.9.3-p448 - #configuring........
Error running './configure --prefix=/Users/pedro/.rvm/rubies/ruby-1.9.3-p448 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl --without-tcl --without-tk --enable-shared',
please read /Users/pedro/.rvm/log/1383305143_ruby-1.9.3-p448/configure.log
There has been an error while running configure. Halting the installation.

configure.log尾部:

$ tail  /Users/pedro/.rvm/log/1383305143_ruby-1.9.3-p448/configure.log
current path: /Users/pedro/.rvm/src/ruby-1.9.3-p448
command(6): ./configure --prefix=/Users/pedro/.rvm/rubies/ruby-1.9.3-p448 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl --without-tcl --without-tk --enable-shared
configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... i386-apple-darwin13.0.0
checking host system type... i386-apple-darwin13.0.0
checking target system type... i386-apple-darwin13.0.0
checking whether the C compiler works... no
configure: error: in `/Users/pedro/.rvm/src/ruby-1.9.3-p448':
configure: error: C compiler cannot create executables
See `config.log' for more details

config.log内容:

    This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ./configure --prefix=/Users/pedro/.rvm/rubies/ruby-1.9.3-p448 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl --without-tcl --without-tk --enable-shared

## --------- ##
## Platform. ##
## --------- ##

hostname = pedros-mbp.home
uname -m = x86_64
uname -r = 13.0.0
uname -s = Darwin
uname -v = Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64

/usr/bin/uname -p = i386
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = Mach kernel version:
     Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64
Kernel configured for up to 8 processors.
4 processors are physically available.
8 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1 2 3 4 5 6 7
Primary memory available: 4.00 gigabytes
Default processor set: 170 tasks, 969 threads, 8 processors
Load average: 2.68, Mach factor: 5.31
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/local/opt/gcc46/bin
PATH: /usr/local/opt/pkg-config/bin
PATH: /usr/local/opt/libtool/bin
PATH: /usr/local/opt/automake/bin
PATH: /usr/local/opt/autoconf/bin
PATH: /opt/local/bin
PATH: /opt/local/sbin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /usr/local/bin
PATH: /Users/pedro/.rvm/bin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2799: checking build system type
configure:2813: result: i386-apple-darwin13.0.0
configure:2881: checking host system type
configure:2894: result: i386-apple-darwin13.0.0
configure:2914: checking target system type
configure:2927: result: i386-apple-darwin13.0.0
configure:3408: checking for C compiler version
configure:3417: /bin/gcc-4.6 --version >&5
./configure: line 3419: /bin/gcc-4.6: No such file or directory
configure:3428: $? = 127
configure:3417: /bin/gcc-4.6 -v >&5
./configure: line 3419: /bin/gcc-4.6: No such file or directory
configure:3428: $? = 127
configure:3417: /bin/gcc-4.6 -V >&5
./configure: line 3419: /bin/gcc-4.6: No such file or directory
configure:3428: $? = 127
configure:3417: /bin/gcc-4.6 -qversion >&5
./configure: line 3419: /bin/gcc-4.6: No such file or directory
configure:3428: $? = 127
configure:3448: checking whether the C compiler works
configure:3470: /bin/gcc-4.6    conftest.c  >&5
./configure: line 3472: /bin/gcc-4.6: No such file or directory
configure:3474: $? = 127
configure:3512: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define CANONICALIZATION_FOR_MATHN 1
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3517: error: in `/Users/pedro/.rvm/src/ruby-1.9.3-p448':
configure:3519: error: C compiler cannot create executables
See `config.log' for more details

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=i386-apple-darwin13.0.0
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=set
ac_cv_env_CC_value=/bin/gcc-4.6
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=i386-apple-darwin13.0.0
ac_cv_prog_CC=/bin/gcc-4.6
ac_cv_target=i386-apple-darwin13.0.0

## ----------------- ##
## Output variables. ##
## ----------------- ##

ALLOCA=''
AR=''
ARCHFILE=''
ARCH_FLAG=''
AS=''
ASFLAGS=''
BASERUBY='ruby'
BUILTIN_ENCOBJS=''
BUILTIN_TRANSOBJS=''
BUILTIN_TRANSSRCS=''
CAPITARGET=''
CC='/bin/gcc-4.6'
CCDLFLAGS=''
CFLAGS=''
CHDIR=''
COMMON_HEADERS=''
COMMON_LIBS=''
COMMON_MACROS=''
COUTFLAG=''
CP=''
CPP=''
CPPFLAGS=''
CPPOUTFILE=''
CXX=''
CXXFLAGS=''
DEFS=''
DLDFLAGS=''
DLDLIBS=''
DLEXT2=''
DLEXT=''
DLLWRAP=''
DOT=''
DOXYGEN=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP=''
ENABLE_SHARED=''
EXECUTABLE_EXTS=''
EXEEXT=''
EXPORT_PREFIX=''
EXTDLDFLAGS=''
EXTOUT=''
EXTSTATIC=''
GCC=''
GNU_LD=''
GREP=''
INSTALLDOC=''
INSTALL_DATA=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
LDFLAGS=''
LDSHARED=''
LDSHAREDXX=''
LIBEXT=''
LIBOBJS=''
LIBPATHENV=''
LIBPATHFLAG=''
LIBRUBY=''
LIBRUBYARG=''
LIBRUBYARG_SHARED=''
LIBRUBYARG_STATIC=''
LIBRUBY_A=''
LIBRUBY_ALIASES=''
LIBRUBY_DLDFLAGS=''
LIBRUBY_LDSHARED=''
LIBRUBY_RELATIVE=''
LIBRUBY_SO=''
LIBS=''
LINK_SO=''
LN_S=''
LTLIBOBJS=''
MAINLIBS=''
MAJOR='1'
MAKEDIRS=''
MAKEFILES=''
MANTYPE=''
MINIOBJS=''
MINIRUBY=''
MINOR='9'
MKDIR_P=''
NM=''
NROFF=''
NULLCMD=''
OBJCOPY=''
OBJDUMP=''
OBJEXT=''
OUTFLAG=''
PACKAGE=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
PKG_CONFIG=''
PLATFORM_DIR=''
POSTLINK=''
PREP=''
RANLIB=''
RDOCTARGET=''
RI_BASE_NAME=''
RM=''
RMALL=''
RMDIR=''
RMDIRS=''
RPATHFLAG=''
RUBYW_BASE_NAME='rubyw'
RUBYW_INSTALL_NAME=''
RUBY_BASE_NAME='ruby'
RUBY_INSTALL_NAME=''
RUBY_PROGRAM_VERSION='1.9.3'
RUBY_RELEASE_DATE='2013-06-27'
RUBY_SO_NAME=''
RUNRUBY=''
SET_MAKE=''
SHELL='/bin/sh'
SOLIBS=''
STATIC=''
STRIP=''
SYMBOL_PREFIX=''
TEENY='1'
TEST_RUNNABLE=''
THREAD_MODEL=''
TRY_LINK=''
UNIVERSAL_ARCHNAMES=''
UNIVERSAL_INTS=''
USE_RUBYGEMS=''
WERRORFLAG=''
WINDRES=''
XCFLAGS=''
XLDFLAGS=''
XRUBY=''
XRUBY_LIBDIR=''
XRUBY_RUBYHDRDIR=''
XRUBY_RUBYLIBDIR=''
ac_ct_CC=''
ac_ct_CXX=''
ac_ct_OBJCOPY=''
ac_ct_OBJDUMP=''
arch=''
bindir='${exec_prefix}/bin'
build='i386-apple-darwin13.0.0'
build_alias=''
build_cpu='i386'
build_os='darwin13.0.0'
build_vendor='apple'
cflags=' ${optflags} ${debugflags} ${warnflags}'
configure_args=''
cppflags=''
cxxflags=' ${optflags} ${debugflags} ${warnflags}'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
debugflags=''
docdir='${datarootdir}/doc/${PACKAGE}'
dvidir='${docdir}'
exec=''
exec_prefix='NONE'
host='i386-apple-darwin13.0.0'
host_alias=''
host_cpu='i386'
host_os='darwin13.0.0'
host_vendor='apple'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
optflags=''
pdfdir='${docdir}'
prefix='/Users/pedro/.rvm/rubies/ruby-1.9.3-p448'
program_transform_name='s&^&&'
psdir='${docdir}'
ridir=''
ruby_pc=''
ruby_version=''
rubyhdrdir=''
rubylibprefix=''
rubyw_install_name=''
sbindir='${exec_prefix}/sbin'
setup=''
sharedstatedir='${prefix}/com'
sitearch=''
sitedir=''
sitehdrdir=''
sysconfdir='${prefix}/etc'
target='i386-apple-darwin13.0.0'
target_alias=''
target_cpu='i386'
target_os='darwin13.0.0'
target_vendor='apple'
try_header=''
vendordir=''
vendorhdrdir=''
warnflags=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define CANONICALIZATION_FOR_MATHN 1

configure: exit 77

最佳答案

我使用了@UnholySheep 的建议并解决了我的问题。

首先我发现安装了gcc46:

$ gcc-4.6 -v
Using built-in specs.
COLLECT_GCC=gcc-4.6
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc46/4.6.4/libexec/gcc/x86_64-apple-darwin13.0.0/4.6.4/lto-wrapper
Target: x86_64-apple-darwin13.0.0
Configured with: ../configure --build=x86_64-apple-darwin13.0.0 --prefix=/usr/local/Cellar/gcc46/4.6.4 --enable-languages=c --program-suffix=-4.6 --with-gmp=/usr/local/opt/gmp4 --with-mpfr=/usr/local/opt/mpfr2 --with-mpc=/usr/local/opt/libmpc08 --with-ppl=/usr/local/opt/ppl011 --with-cloog=/usr/local/opt/cloog-ppl015 --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --disable-werror --enable-plugin --disable-nls --disable-multilib
Thread model: posix
gcc version 4.6.4 (GCC)

我使用了locate gcc-4.6,发现homebrew安装在了/usr/local/bin下。然后按照@UnholySheep 的建议创建一个符号链接(symbolic link):

sudo ln -s /usr/local/bin/gcc-4.6 /bin/gcc-4.6

关于ruby-on-rails - 在 Mac OS Mavericks 中安装 ruby​​ 1.9.3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19727392/

相关文章:

ruby - 使用 Ruby 通过通配符列出 EC2 实例

linux - cat 在 mac 上使用相对路径

ios - Xcode - 从本地化中排除某些字符串

ruby-on-rails - 在不去除换行符的情况下在 Ruby 中分解多行的长字符串

mysql - rails 大量数据在单次插入 activerecord 中发出

ruby-on-rails - 如何在 rails 中显示查看次数(例如此链接/页面已被查看 68 次)?

mysql - 什么时候应该在 MySQL 表中使用 "NOT NULL",有什么好处吗?

ruby-on-rails - 如何按关联表的计算进行过滤?

ruby - Jekyll 有多语言支持吗?

ios - 使用自动布局分配中心