Having difficulty installing rvm 1.9.3 with xcode 4.3.2 - ruby-on-rails

If I type xcodebuild -version it recognises that I have xcode installed:
Xcode 4.3.2
Build version 4E2002
But then when I try to check rvm requirements I get the following:
Notes for Mac OS X 10.7.3, No Xcode.
For JRuby: Install the JDK. See http://developer.apple.com/java/download/ # Current Java version "1.6.0_26"
For IronRuby: Install Mono >= 2.6
For Ruby 1.9.3: Install libksba # If using Homebrew, 'brew install libksba'
You can use & download osx-gcc-installer: https://github.com/kennethreitz/osx-gcc- installer
** NOTE: Currently, Node.js is having issues building with osx-gcc-installer. The only fix is to install Xcode over osx-gcc-installer.
We had reports of http://hpc.sourceforge.net/ making things work, but it looks like not easiest/safest to setup.
To use an RVM installed Ruby as default, instead of the system ruby:
rvm install 1.8.7 # installs patch 357: closest supported version
rvm system ; rvm gemset export system.gems ; rvm 1.8.7 ; rvm gemset import system.gems # migrate your gems
rvm alias create default 1.8.7
And reopen your terminal windows.
Xcode 4.2:
* is only supported by ruby 1.9.3+ using command line flag: --with-gcc=clang
* it breaks gems with native extensions, especially DB drivers.
It seems that it is not recognising my xcode and when I try to install rvm 1.9.3 I get:
Fetching yaml-0.1.4.tar.gz to /Users/sikandarshukla/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/sikandarshukla/.rvm/src
Configuring yaml in /Users/sikandarshukla/.rvm/src/yaml-0.1.4.
Error running ' ./configure --prefix="/Users/sikandarshukla/.rvm/usr" ', please read /Users/sikandarshukla/.rvm/log/ruby-1.9.3-p125/yaml/configure.log
Compiling yaml in /Users/sikandarshukla/.rvm/src/yaml-0.1.4.
Error running 'make ', please read /Users/sikandarshukla/.rvm/log/ruby-1.9.3- p125/yaml/make.log
Database file /Users/sikandarshukla/.rvm/config/packages does not exist.
/Users/sikandarshukla/.rvm/scripts/functions/build: line 28: --version: command not found
Installing Ruby from source to: /Users/sikandarshukla/.rvm/rubies/ruby-1.9.3-p125, this may take a while depending on your cpu(s)...
ruby-1.9.3-p125 - #fetching
ruby-1.9.3-p125 - #extracted to /Users/sikandarshukla/.rvm/src/ruby-1.9.3-p125 (already extracted)
ruby-1.9.3-p125 - #configuring
Error running ' ./configure --prefix=/Users/sikandarshukla/.rvm/rubies/ruby-1.9.3-p125 -- enable-shared --disable-install-doc --with-libyaml --with-opt- dir=/Users/sikandarshukla/.rvm/usr ', please read /Users/sikandarshukla/.rvm/log/ruby-1.9.3- p125/configure.log
There has been an error while running configure. Halting the installation.
Now if i read the log, the output of cat /Users/sikandarshukla/.rvm/log/ruby-1.9.3-p125/configure.log is the following:
./configure --prefix=/Users/sikandarshukla/.rvm/rubies/ruby-1.9.3-p125 --enable-shared -- disable-install-doc --with-libyaml --with-opt-dir=/Users/sikandarshukla/.rvm/usr
configure: WARNING: unrecognized options: --with-libyaml
checking build system type... i386-apple-darwin11.3.0
checking host system type... i386-apple-darwin11.3.0
checking target system type... i386-apple-darwin11.3.0
checking whether the C compiler works... no
configure: error: in `/Users/sikandarshukla/.rvm/src/ruby-1.9.3-p125':
configure: error: C compiler cannot create executables
See `config.log' for more details
and the output of cat /Users/sikandarshukla/.rvm/log/ruby-1.9.3-p125/yaml/configure.log is the following:
./configure --prefix="/Users/sikandarshukla/.rvm/usr"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/sikandarshukla/.rvm/src/yaml-0.1.4':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
Any ideas what to do, Thanks for your help

It's a bug in recognizing Xcode version, I have created a ticket and it should be solved shortly -> https://github.com/wayneeseguin/rvm/issues/846
All Xcode 4.2+ have the same issue:
4.2:
is only supported by ruby 1.9.3+ using command line flag: --with-gcc=clang
it breaks gems with native extensions, especially DB drivers.
To solve use osx-gcc-installer:
You can use & download osx-gcc-installer: https://github.com/kennethreitz/osx-gcc-installer

Related

Error installing Ruby 2.3.0 on Yosemite via rbenv

For some reason I can't get ruby 2.3.0 installed via RBENV. I got it to work with RVM though. Let me know if I need to provide further information.
Here's the error I get:
Downloading ruby-2.3.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.bz2
Installing ruby-2.3.0...
BUILD FAILED (OS X 10.10.5 using ruby-build 20160426)
Inspect or clean up the working tree at /tmp/ruby-build.20160426211028.6622
Results logged to /tmp/ruby-build.20160426211028.6622.log
Last 10 log lines:
config.guess already exists
config.sub already exists
checking build system type... x86_64-apple-darwin14.5.0
checking host system type... x86_64-apple-darwin14.5.0
checking target system type... x86_64-apple-darwin14.5.0
checking whether the C compiler works... no
configure: error: in `/tmp/ruby-build.20160426211028.6622/ruby-2.3.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** No targets specified and no makefile found. Stop.
your system has too strict security policy, so add sudo for the rbenv to give the ability to add executions. So you will like something like:
sudo rbenv install 2.3.0

Can't install gems with native libs on Mavericks (a.k.a. Travis call home)

I cannot get a number of ruby gems to install on my machine, they all fail with something related to compiling the native part, and I can't get any of the solutions to work.
I'm looking forward to the famed ruby productivity, but after a whole day of battling with these install issues I really need some help to get a database gem working so I can get started on RoR.
It first happened with mysql gem, but also happens with sqlite3, and even trying to reinstall ruby-debug gem.
OS: Mac OS X 10.9.2 (Mavericks).
ruby -v =>
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0]
rvm list =>
> rvm rubies
> =* ruby-2.1.1 [ x86_64 ]
> # => - current
> # =* - current && default
> # * - default
rvm -v =>
rvm 1.25.24 (master) by Wayne E. Seguin ,
Michal Papis [https://rvm.io/]
gem -v =>
2.2.2
I have an up to date Xcode 5.1
xcode-select -v => xcode-select version 2333.
I have installed again the command line tools using:
xcode-select --install
I have then tried a number of XCode commands from other responses including:
sudo xcode-select -s /Library/Developer/CommandLineTools/
I have tried multiple answers related to gcc and linking gcc4.2 to gcc using symlinks.
/usr/bin/gcc-4.2 -v =>
Using built-in specs. Target: i686-apple-darwin11 Configured with:
/Volumes/Media/Builds/gcc-5666.3/build/obj/src/configure
--disable-checking --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++,fortran --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/include/c++/4.2.1 Thread model: posix gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
An example failure is this one:
gem install mysql2
Building native extensions. This could take a while... ERROR: Error
installing mysql2: ERROR: Failed to build gem native extension.
/Users/andrew/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb checking for ruby/thread.h... yes checking for rb_thread_call_without_gvl() in
ruby/thread.h... yes checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes checking for
rb_hash_dup()... yes checking for rb_intern3()... yes
----- Using mysql_config at /usr/local/mysql/bin/mysql_config
----- checking for mysql.h... yes checking for errmsg.h... yes checking for mysqld_error.h... yes
----- Setting rpath to /usr/local/mysql/lib
----- creating Makefile
make "DESTDIR=" clean
make "DESTDIR=" compiling client.c compiling infile.c compiling
mysql2_ext.c compiling result.c linking shared-object
mysql2/mysql2.bundle ld: warning: directory not found for option
'-L/Users/travis/.sm/pkg/active/lib'
make "DESTDIR=" install ./install -m 0755 mysql2.bundle
./.gem.20140427-52262-1rr56ob/mysql2 make: ./install: No such file or
directory make: * [install-so] Error 1
make install failed, exit code 2
Gem files will remain installed in
/Users/andrew/.rvm/gems/ruby-2.1.1/gems/mysql2-0.3.15 for inspection.
Results logged to
/Users/andrew/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-12/2.1.0-static/mysql2-0.3.15/gem_make.out
Any ideas anyone?
One post I saw hinted at problems mixing some 64bit and 32bit components of Ruby, Gems, etc. But I didn't see a fix, or how I should go about re-installing a 32bit-only set of components.
P.S. It looks like a certain "Travis" should try to avoid putting references to his own directories into the code:
linking shared-object sqlite3/sqlite3_native.bundle ld: warning:
directory not found for option '-L/Users/travis/.sm/pkg/active/lib'
UPDATE 1
echo $PATH
/Users/andrew/.rvm/gems/ruby-2.1.1/bin:/Users/andrew/.rvm/gems/ruby-2.1.1#global/bin:/Users/andrew/.rvm/rubies/ruby-2.1.1/bin:/Users/andrew/.rvm/bin:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin:.:/usr/lib/tuenti_tools/bin:/Users/andrew/bin:/Users/andrew/apache-maven-3.0.4/bin:/Users/andrew/android-sdk-macosx/platform-tools:/Users/andrew/android-sdk-macosx/tools:/Users/andrew/android-sdk-macosx/build_tools/17.0.0/:/Users/andrew/neo4j-community-2.0.0-M06/bin:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin:.:/usr/lib/tuenti_tools/bin:/Users/andrew/bin:/Users/andrew/apache-maven-3.0.4/bin:/Users/andrew/android-sdk-macosx/platform-tools:/Users/andrew/android-sdk-macosx/tools:/Users/andrew/android-sdk-macosx/build_tools/17.0.0/:/Users/andrew/neo4j-community-2.0.0-M06/bin:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/local/mysql/bin
Generally you'll get errors from exten.conf when dependencies and/or paths are out of wack. First make sure that your paths are working as you'd expect and that ruby in the command line is from rvm:
# this should output the path to the ruby in the .rvm dir
which ruby
Before you try anything else, make sure your homebrew is up-to-date and healthy:
# cd to the homebrew dir, typically here:
cd /usr/local/Cellar
git fetch origin
git reset --hard origin/master
brew update
Before you start installing stuff, make sure your PATHs are loading right. First, you want to load the homebrew bins first. In your .bash_profile or .bashrc file(s) you may or may not have a setting for the PATH, but make sure you have a line that fixes the order to something like this:
export PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:$PATH
You just want to make sure that you're loading /usr/local/bin first. Also make sure that you have the RVM function loading correctly in your .bash_profile or .bashrc:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
Make sure all brew dependencies are aligned, and fix anything it may say:
brew missing
You’ll also want to check on the health of your brews, and fix anything it suggests (I know you've done this already, but there may be new issues after refreshing your local repo and cleaning up from the previous command):
brew doctor
Not sure how you "patched" the gcc issue, but homebrew is great for that:
brew install apple-gcc42
After all that, I can rest assured it's not an issue with your local homebrew setup. I'd recommend using homebrew wherever you can for any native extensions (including mysql/postgres/etc). If you've done so already, uninstall the brew and re-install it:
brew uninstall mysql
brew install mysql
If after all that you still get errors, try cleaning up rvm:
rvm cleanup
rvm repair
Then uninstall/install the failing gem:
gem uninstall mysql2
gem install mysql2
Good luck!

Update ruby version on MAC

I'm trying to update ma ruby version.
I'm with ruby 1.8.7 and I would like to install 2.1.0.
I just installed rvm, rbenv, brew and gem.
But when I try to do
$ rbenv install 2.1.0.
I get an error about clang. I don't get the point between clang and ruby
Could you please help me?
Error:
$ rbenv install 2.1.0
Downloading ruby-2.1.0.tar.gz...
Installing ruby-2.1.0...
BUILD FAILED
...
Last 10 log lines:
...
checking build system type... x86_64-apple-darwin12.3.0
checking host system type... x86_64-apple-darwin12.3.0
checking target system type... x86_64-apple-darwin12.3.0
checking for gcc-4.2... no
checking for clang... no
checking for gcc... no
checking for cc... no
./configure: line 3390: -E: command not found
configure: error: clang version 3.0 or later is required
You need to install the Developer Tools command-line tools in order to build Ruby. As one option, you can install Xcode from the App Store, and Xcode will let you install the command line tools if they aren't automatically installed with your version.
You can install developer command line tools without installing Xcode. Just type the following in the terminal:
xcode-select --install

Installing Ruby on Rails on Mac is failing

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
Here are some screenshots how to install command line tools for XCode (you can install XCode from Mac AppStore):
http://d.pr/i/YJJp
http://d.pr/i/ntLu
http://d.pr/i/cOFv
After installing command line tools you will have a C/C++ compiler on your machine.

Trouble Installing Ruby on Mac OSX 10.6.8 Snow Leopard

I just installed Ruby Version Manager 1.10.2 and attempted to install Ruby 1.9.2 and I get the following error:
ayman-al-abdullahs-macbook:~ Terminal$ rvm install 1.9.2
Fetching yaml-0.1.4.tar.gz to /Users/Terminal/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/Terminal/.rvm/src
Configuring yaml in /Users/Terminal/.rvm/src/yaml-0.1.4.
Error running ' ./configure --prefix="/Users/Terminal/.rvm/usr" ', please read /Users/Terminal/.rvm/log/ruby-1.9.2-p290/yaml/configure.log
Compiling yaml in /Users/Terminal/.rvm/src/yaml-0.1.4.
Error running 'make ', please read /Users/Terminal/.rvm/log/ruby-1.9.2- p290/yaml/make.log
Database file /Users/Terminal/.rvm/config/packages does not exist.
Installing Ruby from source to: /Users/Terminal/.rvm/rubies/ruby-1.9.2-p290, this may take a while depending on your cpu(s)...
ruby-1.9.2-p290 - #fetching
ruby-1.9.2-p290 - #extracting ruby-1.9.2-p290 to /Users/Terminal/.rvm/src/ruby-1.9.2- p290
ruby-1.9.2-p290 - #extracted to /Users/Terminal/.rvm/src/ruby-1.9.2-p290
ruby-1.9.2-p290 - #configuring
Error running ' ./configure --prefix=/Users/Terminal/.rvm/rubies/ruby-1.9.2-p290 -- enable-shared --disable-install-doc --with-libyaml --with-opt-dir=/Users/Terminal/.rvm/usr ', please read /Users/Terminal/.rvm/log/ruby-1.9.2-p290/configure.log
There has been an error while running configure. Halting the installation.
I opened the .rvm/log/ruby-1.9.2-p290/configure.log I received the following error:
[2012-02-10 21:14:02] ./configure --prefix=/Users/Terminal/.rvm/rubies/ruby-1.9.2-p290 --enable-shared --disable-install-doc --with-libyaml --with-opt-dir=/Users/Terminal/.rvm/usr
configure: WARNING: unrecognized options: --with-libyaml
checking build system type... i386-apple-darwin10.8.0
checking host system type... i386-apple-darwin10.8.0
checking target system type... i386-apple-darwin10.8.0
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/Terminal/.rvm/src/ruby-1.9.2-p290':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
I tried rm the file and reinstalling it, and I still get the same error.
Does anyone have any clue what this could be?
Thank you!
UPDATE UPDATE
Fixed it!
Downloading xcode from Apple requires you to be a developer ($99) or pay $5 for version 10.7 (which requires Lion).
I was able to procure an older version of XCode made specifically for Snow Leapard (4.0.2). After downloading, and installing Ruby version 1.9.3 it ran perfectly.
Thank you all for your help!
Let me know if anyone else runs into this same issue and I'll be happy to walk you through my terminal steps (saved the terminal log).
It seems you don't have gcc. Install Apple Developer Tools.
I fixed it!
Downloading xcode from Apple requires you to be a developer ($99) or pay $5 for version 10.7 (which requires Lion).
I was able to procure an older version of XCode made specifically for Snow Leapard (4.0.2). After downloading, and installing Ruby version 1.9.3 it ran perfectly.
Thank you all for your help!
Let me know if anyone else runs into this same issue and I'll be happy to walk you through my terminal steps (saved the terminal log).

Resources