Installing Ruby on Rails on Mac is failing

2019-08-01 18:23发布

问题:

I am trying to install Ruby on rails on my Mac for the first time.

I ran the following command on my terminal windows -

rvm install 2.0.0

But I keep getting this error.

Error running './configure --prefix=/Users/tusharmathur/.rvm/rubies/ruby-2.0.0-p0 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libxml2:/usr/local/opt/libxslt:/usr/local/opt/libksba:/usr/local/opt/openssl:/usr/local/opt/sqlite --disable-install-doc --without-tcl --without-tk --enable-shared',
please read /Users/tusharmathur/.rvm/log/ruby-2.0.0-p0/configure.log
There has been an error while running configure. Halting the installation.

I saw the configure.log also, here is the information -

[2013-03-15 01:11:06] ./configure
configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... i386-apple-darwin12.2.1
checking host system type... i386-apple-darwin12.2.1
checking target system type... i386-apple-darwin12.2.1
checking whether the C compiler works... no
configure: error: in `/Users/tusharmathur/.rvm/src/ruby-2.0.0-p0':
configure: error: C compiler cannot create executables
See `config.log' for more details

回答1:

Here are some screenshots how to install command line tools for XCode (you can install XCode from Mac AppStore):

  1. http://d.pr/i/YJJp
  2. http://d.pr/i/ntLu
  3. http://d.pr/i/cOFv

After installing command line tools you will have a C/C++ compiler on your machine.