Ruby on rails installation fails on my mac - ruby-on-rails

Running:
Mac OS X Lion 10.7.4
xCode Version 4.4.1
Ruby 1.8.x
Brew
Rvm
I'm trying to install ruby on rails on my mac (above are my specs). But it doesn't really come out the way it used to be. I tried several tutorials on the web including Stack Overflow.
As soon as I try:
$ sudo gem install rails
I get this error:
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
Same with Ruby 1.9.2
EDIT
Error for installing ruby
Peter-Corverss-MacBook-Pro:~ Beer$ rvm install ruby-1.9.2-p290
Fetching yaml-0.1.4.tar.gz to /Users/Beer/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/Beer/.rvm/src
Configuring yaml in /Users/Beer/.rvm/src/yaml-0.1.4.
Error running './configure --prefix=/Users/Beer/.rvm/usr', please read /Users/Beer/.rvm/log/ruby-1.9.2-p290/yaml/configure.log
Compiling yaml in /Users/Beer/.rvm/src/yaml-0.1.4.
Error running 'make', please read /Users/Beer/.rvm/log/ruby-1.9.2-p290/yaml/make.log
Installing Ruby from source to: /Users/Beer/.rvm/rubies/ruby-1.9.2-p290, this may take a while depending on your cpu(s)...
ruby-1.9.2-p290 - #downloading ruby-1.9.2-p290, 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 8604k 100 8604k 0 0 225k 0 0:00:38 0:00:38 --:--:-- 202k
ruby-1.9.2-p290 - #extracting ruby-1.9.2-p290 to /Users/Beer/.rvm/src/ruby-1.9.2-p290
ruby-1.9.2-p290 - #extracted to /Users/Beer/.rvm/src/ruby-1.9.2-p290
ruby-1.9.2-p290 - #configuring
Error running './configure --prefix=/Users/Beer/.rvm/rubies/ruby-1.9.2-p290 --enable-shared --disable-install-doc --with-libyaml --with-opt-dir=/Users/Beer/.rvm/usr', please read /Users/Beer/.rvm/log/ruby-1.9.2-p290/configure.log
There has been an error while running configure. Halting the installation.
Above code with some color (image):
This is the start for installing ruby and I can't get it to work.
I really tried but I can't fix the problem, hope someone could help me.

Yeah if you're having trouble building ruby, you probably need the command line utilities from Xcode. Checkout: http://developer.apple.com/library/mac/#recipes/xcode_help-documentation_preferences/DownloadingandInstallingXcodeComponents/DownloadingandInstallingXcodeComponents.html
It's in the preferences pane with a downloads tab.
After that installs, reopen terminal and try to install 1.9.2 through rvm again. If it doesnt install still, please comment and I'll see if I can figure it out. If it does install, try installing both rails & bundler:
rvm use ruby-1.9.2 --default
gem install rails
gem install bundler
The first line will switch you into 1.9.2 and should set it up as your default environment.

Related

El Capitan Ruby binaries installation issue

Just trying to get through some parts of the Hartl rails tutorial to familiarize myself with the rails framework. I have homebrew installed (removed and reinstalled it because it giving me trouble after using El Capitan), and got a fresh version of rvm with rvm get stable
I went into the directory containing the project, and I got this message
ruby-2.3.0-dev is not installed.
To install do: 'rvm install ruby-2.3.0-dev'
Previously, I'd tried using 2.3.0 as the latest version (it was the newest thing showing up when I ran rvm list, not sure why), but now I want to change that to 2.3.1. Anybody know how I can change the ruby version for this project?
Additionally, when I run rvm install ruby-2.3.1 , I get this error
No binary rubies available for: osx/10.11/x86_64/ruby-2.3.1.
This led me to trying to reinstall homebrew, update my version of rvm, etc. I tried all of that and am still getting this error message.
The whole reason this happened is because I tried executing a test with
$ bundle exec rake test
I got this message
RubyDep: WARNING: Your Ruby is outdated/buggy. (To disable warnings, set RUBY_DEP_GEM_SILENCE_WARNINGS=1)
RubyDep: WARNING: Your Ruby is: 2.3.0 (buggy). Recommendation: install 2.3.1.
Haven't been able to install 2.3.1 and I'm just losing my mind here.
edit - Does one recommend installing directly from source instead of using binaries?
I've reproduced your steps in my Mac laptop running OS X El Capitan. Executing the command rvm install 2.3.1 I got the same error as you, but after that rvm kept on executing the command and eventually downloaded and installed the binaries of Ruby 2.3.1. My output was like this:
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.11/x86_64/ruby-2.3.1.
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/user/.rvm/rubies/ruby-2.3.1, this may take a while depending on your cpu(s)...
ruby-2.3.1 - #downloading ruby-2.3.1, 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 13.7M 100 13.7M 0 0 5854k 0 0:00:02 0:00:02 --:--:-- 5855k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.3.1 - #extracting ruby-2.3.1 to /Users/user/.rvm/src/ruby-2.3.1....
ruby-2.3.1 - #configuring...........................................................
ruby-2.3.1 - #post-configuration.
ruby-2.3.1 - #compiling.............................................................
ruby-2.3.1 - #installing.........
ruby-2.3.1 - #making binaries executable..
Installed rubygems 2.5.1 is newer than 2.4.8 provided with installed ruby, skipping installation, use --force to force installation.
ruby-2.3.1 - #gemset created /Users/user/.rvm/gems/ruby-2.3.1#global
ruby-2.3.1 - #importing gemset /Users/user/.rvm/gemsets/global.gems...............................................
ruby-2.3.1 - #generating global wrappers........
ruby-2.3.1 - #gemset created /Users/user/.rvm/gems/ruby-2.3.1
ruby-2.3.1 - #importing gemsetfile /Users/user/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.3.1 - #generating default wrappers........
ruby-2.3.1 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.3.1 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
After that I executed rvm use 2.3.1 and ruby -v and the output of the last command was:
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
So I could successfully install Ruby 2.3.1 on Mac OS X El Capitan. Please provide further information if this cannot help solving your problem.

ERROR: Error running 'GEM_PATH=" qhen running "sudo rvm install 1.9.3-p194" [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Installed Ruby 1.9.3 with RVM but command line doesn’t show ruby -v
I try to run this comand
-> sudo rvm install 1.9.3-p194
but this errors appears and the instalation was unsuccessful
Installing Ruby from source to: /usr/share/ruby-rvm/rubies/ruby-1.9.3-p194, this may take a while depending on your cpu(s)...
ruby-1.9.3-p194 - #fetching
ruby-1.9.3-p194 - #downloading ruby-1.9.3-p194, 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 9610k 100 9610k 0 0 181k 0 0:00:53 0:00:53 --:--:-- 235k
ruby-1.9.3-p194 - #extracting ruby-1.9.3-p194 to /usr/share/ruby-rvm/src/ruby-1.9.3-p194
ruby-1.9.3-p194 - #extracted to /usr/share/ruby-rvm/src/ruby-1.9.3-p194
ruby-1.9.3-p194 - #configuring
ruby-1.9.3-p194 - #compiling
ruby-1.9.3-p194 - #installing
Removing old Rubygems files...
-e:1: Use RbConfig instead of obsolete and deprecated Config.
Installing rubygems dedicated to ruby-1.9.3-p194...
Retrieving rubygems-latest-1.8
Extracting rubygems-latest-1.8 ...
ERROR: Error running 'gunzip < /usr/share/ruby-rvm/archives/rubygems-latest-1.8.tgz | tar xf - -C /usr/share/ruby-rvm/src', please read /usr/share/ruby-rvm/log/ruby-1.9.3-p194/rubygems.extract.log
Installing rubygems for /usr/share/ruby-rvm/rubies/ruby-1.9.3-p194/bin/ruby
ERROR: Error running 'GEM_PATH="/usr/share/ruby-rvm/gems/ruby-1.9.3-p194:/usr/share/ruby-rvm/gems/ruby-1.9.3-p194#global:/usr/share/ruby-rvm/gems/ruby-1.9.3-p194:/usr/share/ruby-rvm/gems/ruby-1.9.3-p194#global" GEM_HOME="/usr/share/ruby-rvm/gems/ruby-1.9.3-p194" "/usr/share/ruby-rvm/rubies/ruby-1.9.3-p194/bin/ruby" "/usr/share/ruby-rvm/src/rubygems-latest-1.8/setup.rb"', please read /usr/share/ruby-rvm/log/ruby-1.9.3-p194/rubygems.install.log`
WARN: Installation of rubygems did not complete successfully.
ruby-1.9.3-p194 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.3-p194 - #importing default gemsets (/usr/share/ruby-rvm/gemsets/)
Install of ruby-1.9.3-p194 - #complete
first of all why do you use sudo command before rvm? this link will help you in that rvm.io/rubies/rubygems . I don't thing that you have to use sudo.
Also you can look into this question error while installing ruby 1.9.3 using rvm
Also 'rvm install ruby' will install you latest stable version of ruby.
You are using an very old version of RVM that is packaged with Ubuntu, make sure to follow instructions from this answer https://stackoverflow.com/a/9056395/497756 - gunzip is no more used in RVM so this problem should be fixed.

Updating ror 1.8.7 to 1.9.3

I'm a beginner ror programmer with a macbook air. i've just managed to upgrade my leopard to Lion. Downloaded codex 10.7 and macport and also RVM. The thing i'm trying to do now is to update my ruby from 1.8.7 to 1.9.3 but this is what i got:
I typed out: 'rvm install ruby-1.9.2-p318"
Annie-Tungs-MacBook-Air:~ annietung$ rvm install ruby-1.9.2-p318 Fetching yaml-0.1.4.tar.gz to /Users/annietung/.rvm/archives Extracting yaml-0.1.4.tar.gz to /Users/annietung/.rvm/src Configuring yaml in /Users/annietung/.rvm/src/yaml-0.1.4. Error running ' ./configure --prefix="/Users/annietung/.rvm/usr" ', please read /Users/annietung/.rvm/log/ruby-1.9.2-p318/yaml/configure.log Compiling yaml in /Users/annietung/.rvm/src/yaml-0.1.4. Error running 'make ', please read /Users/annietung/.rvm/log/ruby-1.9.2-p318/yaml/make.log
Database file /Users/annietung/.rvm/config/packages does not exist.
Installing Ruby from source to: /Users/annietung/.rvm/rubies/ruby-1.9.2-p318, this may take a while depending on your cpu(s)...
ruby-1.9.2-p318 - #fetching ruby-1.9.2-p318 - #extracted to /Users/annietung/.rvm/src/ruby-1.9.2-p318 (already extracted) ruby-1.9.2-p318 - #configuring Error running ' ./configure --prefix=/Users/annietung/.rvm/rubies/ruby-1.9.2-p318 --enable-shared --disable-install-doc --with-libyaml --with-opt-dir=/Users/annietung/.rvm/usr ', please read /Users/annietung/.rvm/log/ruby-1.9.2-p318/configure.log There has been an error while running configure. Halting the installation. ls: /Users/annietung/.rvm/rubies/*/bin/ruby: No such file or directory Annie-Tungs-MacBook-Air:~ annietung$
Looks like you need to download and install Apple's Command Line Tools for OSX Lion so that you can build Ruby properly.

Error while installing Ruby 1.9.3 and Rails 3.1.3 on Mac OS X Lion

I've an error when I want to install Ruby 1.9.3 on OS X. I've seen most of the problem come from xCode not being installed. So, I installed it and I still have the problem, so, here it is:
MacBook-Pro-de-Arnaud:~ Arnaud$ rvm install 1.9.3
Installing Ruby from source to: /Users/Arnaud/.rvm/rubies/ruby-1.9.3-p0, this may take a >while depending on your cpu(s)...
ruby-1.9.3-p0 - #fetching
ruby-1.9.3-p0 - #extracted to /Users/Arnaud/.rvm/src/ruby-1.9.3-p0 (already extracted)
Fetching yaml-0.1.4.tar.gz to /Users/Arnaud/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/Arnaud/.rvm/src
Configuring yaml in /Users/Arnaud/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/Arnaud/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/Arnaud/.rvm/usr
ruby-1.9.3-p0 - #configuring
ERROR: Error running ' ./configure --prefix=/Users/Arnaud/.rvm/rubies/ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml-dir=/Users/Arnaud/.rvm/usr ', please read /Users/Arnaud/.rvm/log/ruby-1.9.3-p0/configure.log
ERROR: There has been an error while running configure. Halting the installation.
So, I decide to let the 1.8.7 and direct go to Rails and the install seems to go well, but nothing is istall :/
MacBook-Pro-de-Arnaud:~ Arnaud$ sudo gem install rails
Password:
Successfully installed rails-3.1.3
1 gem installed
Installing ri documentation for rails-3.1.3...
Installing RDoc documentation for rails-3.1.3...
MacBook-Pro-de-Arnaud:~ Arnaud$ gem list
*** LOCAL GEMS ***
MacBook-Pro-de-Arnaud:~ Arnaud$ rail
-bash: rail: command not found
MacBook-Pro-de-Arnaud:~ Arnaud$ rails
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem'
from /usr/bin/rails:18
Would anyone have a solution ?
rvm install 1.9.3 --with-gcc=clang
As suggested here worked for me.
I had a very similar problem with Ruby 1.9.3.
After going through the logs and trolling the internet I found that I had to:
1 - install GCC
2 - link to 64 bit libraries
3 - reinstall rails and sqlite3
I've noted what I did here to remember what I did, and hopefully help someone else who is having similar issues.

Can't install Ruby on OS X

I'm trying to follow the installation instructions for Ruby on Rails from Hivelogic.com. I've done this before on previous installs of OSX without trouble. I'm having trouble this time installing on Snow Leopard.
At the end of the "make" step installing Ruby, I get a number of errors related to readline. Not sure if this matters, but here they are:
readline.c: In function ‘username_completion_proc_call’:
readline.c:730: error: ‘username_completion_function’ undeclared (first use in this function)
readline.c:730: error: (Each undeclared identifier is reported only once
readline.c:730: error: for each function it appears in.)
make[1]: *** [readline.o] Error 1
make: *** [all] Error 1
When I try to sudo make install, I get more errors. When I "which ruby", I get /usr/local/bin/ruby which is correct. But as soon as I try to use ruby, I get this message: "You need the Rosetta software to run ruby. The Rosetta installer is in Optional Installs on your Mac OS X installation disc." That's weird, but I installed Rosetta, and was able to proceed.
Except: I still have Ruby1.8.6 installed (not 1.8.7). "ruby -v" reports 1.8.6. 1.8.6 was the version that was migrated (I assume) from the Leopard install on this machine. In other words: where's my new Ruby? How do I get 1.8.7 (required by the current version of Rails) installed correctly?
I've always found macports the best way to install/manage my ruby versions. I have 1.8.6, 1.8.7 and 1.9.1 all installed using macports.
First, grab macports and install it.
Then, update (or create) your ~/.bashrc file to include the following line:
export PATH=/opt/local/bin:$PATH
This places all macports executables in front of you path, so you system will find them first.
Finally, install any of the versions of ruby you want:
sudo port install ruby186
sudo port install ruby
sudo port install ruby19
I also recommend installing rubygems from scratch after ruby is installed. Grab the latest rubygems release here and then run the following from inside the downloaded rubygems directory:
sudo ruby setup.rb
Hope this works out for you.
If you have snow leopard than 1.8.7 is pre-installed in /usr/bin
Another option is to use VirtualBox and install Ubuntu on VirtualBox. Ruby installation and usage is much smoother this way I have found, as I wasted a lot of time trying to get Ruby working properly on the Mac.

Resources