Error installing Ruby with RVM (OSX 10.8) - ruby-on-rails

When trying to install Ruby 1.9.3 using RVM (rvm install ruby 1.9.3) I get the following error:
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p362.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Fetching yaml-0.1.4.tar.gz to /Users/christiaan/.rvm/archives
Extracting yaml to /Users/christiaan/.rvm/src/yaml-0.1.4
Configuring yaml in /Users/christiaan/.rvm/src/yaml-0.1.4.
Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --prefix=/Users/christiaan/.rvm/usr', please read /Users/christiaan/.rvm/log/ruby-1.9.3-p362/yaml/configure.log
Compiling yaml in /Users/christiaan/.rvm/src/yaml-0.1.4.
Error running 'make', please read /Users/christiaan/.rvm/log/ruby-1.9.3-p362/yaml/make.log
Installing Ruby from source to: /Users/christiaan/.rvm/rubies/ruby-1.9.3-p362, this may take a while depending on your cpu(s)...
ruby-1.9.3-p362 - #downloading ruby-1.9.3-p362, this may take a while depending on your connection...
ruby-1.9.3-p362 - #extracted to /Users/christiaan/.rvm/src/ruby-1.9.3-p362 (already extracted)
ruby-1.9.3-p362 - #configuring
Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --enable-shared --disable-install-doc --prefix=/Users/christiaan/.rvm/rubies/ruby-1.9.3-p362 --with-opt-dir=/Users/christiaan/.rvm/usr', please read /Users/christiaan/.rvm/log/ruby-1.9.3-p362/configure.log
There has been an error while running configure. Halting the installation.
I've tried all the tips from similar questions, but can't seem to fix this.
YAML Log (first error log produced):
[2012-12-28 16:18:06] env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --prefix=/Users/christiaan/.rvm/usr
current path: /Users/christiaan/.rvm/src/yaml-0.1.4
command(4): env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --prefix=/Users/christiaan/.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)... yes
checking for gcc... /usr/local/bin/gcc-4.2
checking whether the C compiler works... no
configure: error: in `/Users/christiaan/.rvm/src/yaml-0.1.4':
configure: error: C compiler cannot create executables
See `config.log' for more details
RVM Log (second error log produced):
[2012-12-28 16:18:08] env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --enable-shared --disable-install-doc --prefix=/Users/christiaan/.rvm/rubies/ruby-1.9.3-p362 --with-opt-dir=/Users/christiaan/.rvm/usr
current path: /Users/christiaan/.rvm/src/ruby-1.9.3-p362
command(7): env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --enable-shared --disable-install-doc --prefix=/Users/christiaan/.rvm/rubies/ruby-1.9.3-p362 --with-opt-dir=/Users/christiaan/.rvm/usr
checking build system type... x86_64-apple-darwin12.2.0
checking host system type... x86_64-apple-darwin12.2.0
checking target system type... x86_64-apple-darwin12.2.0
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.

Your main issue is:
configure: error: C compiler cannot create executables
So search for solutions to that problem. Like:
rvm install 1.9.3 --with-gcc=clang
Other examples:
How can I install Ruby 1.9.3 in Mac OS X Lion?
Why am I getting a "C compiler cannot create executables" (successfully written C code prior to this and compiles that)?

Xcode->Preferences
Check "Command line tools"

It is a duplicate, there are already few answers for this but I have made the fix also into RVM, make sure to run rvm get head first and read the output - the fix is displayed there.
This problem is also reported back to RailsInstaller: https://github.com/railsinstaller/railsinstaller-nix/issues/10

Related

ruby version change error - "rvm install 3.1.3"

I am trying to update the ruby version from: 2.6.10p210 to 3.1.3.
When updating it with the "rvm" I get the following error.
I am working from my mac m1.
I appreciate any help !
I also tried to upgrade with "rvm" to other versions of ruby, like 3.1.0, 3.1.2, etc.
**code on console:
alvarobarrazaramos#MacBook-Pro-de-Alvaro src % rvm install 3.0.0
ruby-3.0.0 - #removing src/ruby-3.0.0 - please wait
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/13.0/arm64/ruby-3.0.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates bundle '/opt/homebrew/etc/openssl#1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/alvarobarrazaramos/.rvm/rubies/ruby-3.0.0, this may take a while depending on your cpu(s)...
ruby-3.0.0 - #downloading ruby-3.0.0, this may take a while depending on your connection...
ruby-3.0.0 - #extracting ruby-3.0.0 to /Users/alvarobarrazaramos/.rvm/src/ruby-3.0.0 - please wait
ruby-3.0.0 - #configuring - please wait
Error running 'env CFLAGS=-O3 -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl#1.1/include LDFLAGS=-L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl#1.1/lib ./configure --prefix=/Users/alvarobarrazaramos/.rvm/rubies/ruby-3.0.0 --disable-install-doc --enable-shared',
please read /Users/alvarobarrazaramos/.rvm/log/1676851424_ruby-3.0.0/configure.log
There has been an error while running configure. Halting the installation.
alvarobarrazaramos#MacBook-Pro-de-Alvaro src %
log message:
alvarobarrazaramos#MacBook-Pro-de-Alvaro src % cat /Users/alvarobarrazaramos/.rvm/log/1676851424_ruby-3.0.0/configure.log
checking for ruby... /usr/bin/ruby
tool/config.guess already exists
tool/config.sub already exists
checking build system type... aarch64-apple-darwin22.1.0
checking host system type... aarch64-apple-darwin22.1.0
checking target system type... aarch64-apple-darwin22.1.0
checking for ld... ld
checking for gcc-ar... no
checking for g++... g++
checking for gcc-nm... no
checking for gcc-ranlib... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Users/alvarobarrazaramos/.rvm/src/ruby-3.0.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
alvarobarrazaramos#MacBook-Pro-de-Alvaro src %

Error installing rvm 2.3.0 , installation halts

I am trying to install rvm 2.3.0 for 2 days but getting below error.I tried using "rvm install ruby-2.3.0" command.It did not work.Then again I did
rvm get master
rvm install 2.3.1
Again got the same error.Anyone have an idea regarding this.thanks in advance.
Warning, new version of rvm available '1.27.0', you are using older version '1.26.11'.
You can disable this warning with: echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable auto-update with: echo rvm_autoupdate_flag=2 >> ~/.rvmrc
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.10/x86_64/ruby-2.3.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/smrutisumanpanda/.rvm/rubies/ruby-2.3.0, this may take a while depending on your cpu(s)...
ruby-2.3.0 - #downloading ruby-2.3.0, this may take a while depending on your connection...
ruby-2.3.0 - #extracting ruby-2.3.0 to /Users/smrutisumanpanda/.rvm/src/ruby-2.3.0....
ruby-2.3.0 - #configuring.......
Error running './configure --prefix=/Users/smrutisumanpanda/.rvm/rubies/ruby-2.3.0 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl --disable-install-doc --enable-shared',
showing last 15 lines of /Users/smrutisumanpanda/.rvm/log/1475218763_ruby-2.3.0/configure.log
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for cd using physical directory... cd -P
checking whether CFLAGS is valid... no
configure: error: something wrong with CFLAGS="-g -O2 "
There has been an error while running configure. Halting the installation.
Issue resolved.I updated my OS mac version 10.10.2 to 10.10.5.After that i tried installing rvm (rvm install 2.3.0) and it got installed.

gem install debugger -v '1.5.0' fails

I am trying to do bundle in the large project on Mavericks and some gems are broken or something wrong with my environment in spite of this is fresh install of rbenv.
$ gem install debugger -v '1.5.0'
Building native extensions. This could take a while...
ERROR: Error installing debugger:
ERROR: Failed to build gem native extension.
/Users/samat/.rbenv/versions/1.9.3-p448/bin/ruby extconf.rb
checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
Makefile creation failed
**************************************************************************
No source for ruby-1.9.3-p448 provided with debugger-ruby_core_source gem.
**************************************************************************
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
...
Have no idea of what configuration options do I need
In mkmf I see things like
"gcc -I/Users/samat/.rbenv/versions/1.9.3-p448/include/ruby-1.9.1/x86_64-darwin13.0.0 -I/Users/samat/.rbenv/versions/1.9.3-p448/include/ruby-1.9.1/ruby/backward -I/Users/samat/.rbenv/versions/1.9.3-p448/include/ruby-1.9.1 -I. -I/Users/samat/.rbenv/versions/1.9.3-p448/include/ruby-1.9.1/ruby-1.9.3-p448 -I'/Users/samat/.rbenv/versions/1.9.3-p448/include' -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I'/Users/samat/.rbenv/versions/1.9.3-p448/include' -O3 -Wno-error=shorten-64-to-32 -pipe -c conftest.c"
conftest.c:3:10: fatal error: 'method.h' file not found
#include <method.h>
^
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <method.h>
...
I use rbenv,
$ rbenv version
1.9.3-p448 (set by /Users/samat/Documents/bm-git/.ruby-version)
From the debugger page it says that if the ruby source can't be found, it will try to install debugger-ruby_core_source, which is actually what fails for me. I use rbenv, so I according to the debugger gem instructions, I pointed it to the rbenv source.
gem install debugger -- --with-ruby-include=~/.rbenv/versions/1.9.3-p484/include
You better to use latest version of debugger, bc issue with your Ruby version was solved.
There are a lot of issues with Ruby gems and Mavericks. What I have found is that the best bet is to use the apple-gcc42 compiler from homebrew
brew tap homebrew/versions
brew install apple-gcc42
Then force that compiler family to be used when building gems. I put symlinks in my a bin folder in my home directory
cd $HOME/bin
ln -s /usr/local/bin/c++-4.2 c++
ln -s /usr/local/bin/g++-4.2 g++
ln -s /usr/local/bin/gcc-4.2 cc
ln -s /usr/local/bin/gcc-4.2 gcc
You'll need to have your local bin folder on your path.
export PATH=$HOME/bin:$PATH
Then you should be good to go.
may be this will help you gem install debugger-linecache -v '1.1.2' -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p286/
Sometimes this issue is related with missing package. Most of the time these files (for instance method.h) belongs to package named libXXX-dev.
It's difficult for us to know what the package contains file. I've recently bumped into a utility to deal with this annoying problem (for those who works with apt-get package manager). The tool is apt-file and you can use it as follow:
Installation: sudo apt-get install apt-file
Updating apt-file db: sudo apt-file update
Looking at file: sudo apt-file search 'method.h'
The result might be:
...
libcxxtools-dev: /usr/include/cxxtools/constmethod.h
libcxxtools-dev: /usr/include/cxxtools/method.h
libcxxtools-dev: /usr/include/cxxtools/unit/testmethod.h
libgcj12-dev: /usr/include/c++/4.6/gcj/method.h
libgcj13-dev: /usr/include/c++/4.7/gcj/method.h
...
In the particular case of debuggergem the missing package is `libcxxtools-dev``
I'm on Debian 3.2.54-2 x86_64 GNU/Linux
For me it was an issue of permission.
I was able to solve this issue with
sudo gem install debugger
If this doesn't help you may have to get involved in a dependency rabbit hole.

how to update ruby path?

I'm reinstalling ruby with proper instructions this time
but I have paths messed up
this is what I'm getting this error
Last login: Sun Feb 24 02:06:37 on ttys000
Fawads-MacBook-Pro:~ fawadnaseer$ 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.
Installing Ruby from source to: /usr/local/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 /usr/local/rvm/src/ruby-1.9.3-p374
ruby-1.9.3-p374 - #extracted to /usr/local/rvm/src/ruby-1.9.3-p374
ruby-1.9.3-p374 - #configuring
Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --disable-install-doc --prefix=/usr/local/rvm/rubies/ruby-1.9.3-p374 --with-opt-dir=/usr/local/rvm/usr --disable-shared', please read /usr/local/rvm/log/ruby-1.9.3-p374/configure.log
There has been an error while running configure. Halting the installation.
Configure.log file contents
here is the configure.log file
[2013-02-24 02:09:37] ./configure
current path: /usr/local/rvm/src/ruby-1.9.3-p374
command(7): env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --disable-install-doc --prefix=/usr/local/rvm/rubies/ruby-1.9.3-p374 --with-opt-dir=/usr/local/rvm/usr --disable-shared
checking build system type... x86_64-apple-darwin12.2.1
checking host system type... x86_64-apple-darwin12.2.1
checking target system type... x86_64-apple-darwin12.2.1
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
UPDATE:
Ok guys I have RVM installed
Ruby Installed
Rails Installed
what when i put echo $PATH
echo $PATH
/Users/fawadnaseer/.rvm/gems/ruby-1.9.3-p392/bin:/Users/fawadnaseer/.rvm/gems/ruby-1.9.3-p392#global/bin:/Users/fawadnaseer/.rvm/rubies/ruby-1.9.3-p392/bin:/Users/fawadnaseer/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
are there any problem in this path?
Try using the clang compiler instead of the default:
rvm install 1.9.3 --with-gcc=clang

Having difficulty installing rvm 1.9.3 with xcode 4.3.2

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

Resources