Blog‎ > ‎

Trying to Learn How to Code

posted Mar 10, 2012, 5:00 AM by Vishal Jain
Well, day 3 was a miserable failure:

new-host-2:~ veesh$ sudo gem install rails

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

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/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/json-1.6.5 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.6.5/ext/json/ext/parser/gem_make.out
new-host-2:~ veesh$ 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/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/json-1.6.5 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.6.5/ext/json/ext/parser/gem_make.out
new-host-2:~ veesh$ rails --version
Rails is not currently installed on this system. To get the latest version, simply type:

    $ sudo gem install rails

You can then rerun your "rails" command.
new-host-2:~ veesh$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Downloading RVM from wayneeseguin branch stable
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  919k  100  919k    0     0   444k      0  0:00:02  0:00:02 --:--:-- 1257k

Installing RVM to /Users/veesh/.rvm/
    Adding rvm PATH line to /Users/veesh/.bashrc /Users/veesh/.zshrc.
    Adding rvm loading line to /Users/veesh/.bash_login /Users/veesh/.zlogin.

# RVM:  Shell scripts enabling management of multiple ruby environments.
# RTFM: https://rvm.beginrescueend.com/
# HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
# Screencast: http://screencasts.org/episodes/how-to-use-rvm

# In case of any issues read output of 'rvm requirements' and/or 'rvm notes'

Installation of RVM in /Users/veesh/.rvm/ is almost complete:

  * To start using RVM you need to run `source /Users/veesh/.rvm/scripts/rvm`
    in all your open shell windows, in rare cases you need to reopen all shell windows.

  * Optionally you can run `rvm tools rvm-env ruby bash` which will generate 
    shebang wrappers for easier selecting ruby in scripts.

# RockingChair LLC,
#
#   Thank you for using RVM!
#   I sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne

new-host-2:~ veesh$ source ~/.bash_profile
-bash: /Users/veesh/.bash_profile: No such file or directory
new-host-2:~ veesh$ source /Users/veesh/.rvm/scripts/rvm
new-host-2:~ veesh$ source ~/.bash_profile
-bash: /Users/veesh/.bash_profile: No such file or directory
new-host-2:~ veesh$ pico ~/.bashrc
new-host-2:~ veesh$ source ~/.bash_profile
-bash: /Users/veesh/.bash_profile: No such file or directory
new-host-2:~ veesh$ rvm requirements

  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.

new-host-2:~ veesh$ rvm install 1.9.3
Fetching yaml-0.1.4.tar.gz to /Users/veesh/.rvm/archives
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  460k  100  460k    0     0   190k      0  0:00:02  0:00:02 --:--:--  203k
Extracting yaml-0.1.4.tar.gz to /Users/veesh/.rvm/src
Configuring yaml in /Users/veesh/.rvm/src/yaml-0.1.4.
Error running ' ./configure --prefix="/Users/veesh/.rvm/usr"  ', please read /Users/veesh/.rvm/log/ruby-1.9.3-p125/yaml/configure.log
Compiling yaml in /Users/veesh/.rvm/src/yaml-0.1.4.
Error running 'make ', please read /Users/veesh/.rvm/log/ruby-1.9.3-p125/yaml/make.log


Database file /Users/veesh/.rvm/config/packages does not exist.

/Users/veesh/.rvm/scripts/functions/build: line 28: --version: command not found
Installing Ruby from source to: /Users/veesh/.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 - #downloading ruby-1.9.3-p125, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 9505k  100 9505k    0     0   609k      0  0:00:15  0:00:15 --:--:--  771k
ruby-1.9.3-p125 - #extracting ruby-1.9.3-p125 to /Users/veesh/.rvm/src/ruby-1.9.3-p125
ruby-1.9.3-p125 - #extracted to /Users/veesh/.rvm/src/ruby-1.9.3-p125
ruby-1.9.3-p125 - #configuring 
Error running ' ./configure --prefix=/Users/veesh/.rvm/rubies/ruby-1.9.3-p125 --enable-shared --disable-install-doc --with-libyaml --with-opt-dir=/Users/veesh/.rvm/usr ', please read /Users/veesh/.rvm/log/ruby-1.9.3-p125/configure.log
There has been an error while running configure. Halting the installation.
new-host-2:~ veesh$ rvm install 1.9.3 --with-gcc=clang
You requested building with 'clang' but it is not in your path.
new-host-2:~ veesh$ 

Comments