I'm trying to use Rails, when I do this system says the following
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
Then I run - sudo gem install rails
and as the result I got
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
Any ideas how to solve this?
You're a Mac user. The 'common build tools', known as the 'BSD subsytem' in the Xcode package are often outdated. For example the installed ruby is at version 1.8. Do yourself a huge favor and install the common build tools via homebrew package manager. After that I suggest installing a newer version of ruby as rails will soon drop support for the 1.8 series that you're using. Different version of ruby are installed using the ruby version manager
After installing homebrew and rvm you have rock solid base! Installing a ruby version is now just a matter of running rvm install 1.9.2 and you'll get the latest patch version of the 1.9.2 series of the MRI.
With ruby 1.9.2 you will have no problem installing the current version of RubyOnRails.
This chain if tools is what most Ruby/Rails devs use today.
he got problems with installing the json gem. I resolved that issue by installing the Ruby DevKit.
Download form here:
http://rubyinstaller.org/downloads/
Install tutorial here:
https://github.com/oneclick/rubyinstaller/wiki/Development-kit
Cheers Stefan
Related
I know the question to this is probably very straight forward, but Im a bit new to rails, so please bear with me. I have had rails version 5.1.5 on my Mac and I need to update rails to version 5.1.6 and I'm not able for the life of me to do that.
I tried
`sudo gem install rails -v 5.1.6`
but this gives the error
ERROR: Failed to build gem native extension.
Using gem list gives that I have
rails (5.1.5, 5.1.4)
I also tried bundle update rails
I keep getting Could not locate Gemfile
What am I doing wrong??
gem is the native package manager for Ruby.
Bundler (bundle) is a gem to manage bundles of gems via a Gemfile.
I recommend you use a version manager for Ruby like rvm, rbenv or chruby and also install xcode and the commandline-tools package of xcode. Some gems have dependencies written in C that need to be configured and compiled, all of that and some more comes with xcode.
I am newbie to ruby on rails, here i am trying to install ruby on rails on windows 7 64 bit. i installed the ruby installer and i installed rails. and also i created new app files. but when i start the rails server it is showing the following errors.
How can i get rid of these errors and start developing my ruby application?
C:\Users\walnut\Desktop > bundle install
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies.................
Using rake 10.4.2
Using i18n 0.7.0
Installing json 1.8.3 with native extensions
Gem::InstallError: The 'json' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.3'` succeeds before bundling.
C:\Users\walnut\Desktop > rails s
Could not find gem 'mysql2 (>= 0) x64-mingw32' in any of the gem sources listed
in your Gemfile or available on this machine.
Run `bundle install` to install missing gems.
C:\Users\walnut\Desktop > gem install mysql2
Fetching: mysql2-0.3.19.gem (100%)
ERROR: Error installing mysql2:
The 'mysql2' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
C:\Users\walnut\Desktop > rails s
Could not find gem 'mysql2 (>= 0) x64-mingw32' in any of the gem sources listed
in your Gemfile or available on this machine.
Run `bundle install` to install missing gems.
From here,
Follow the Instructions from the Ruby Installer Developer Kit Wiki:
Download DevKit file from rubyinstaller.org
Extract DevKit to path C:\RubyXXX\DevKit
Run cd C:\RubyXXX\DevKit
Run ruby dk.rb init
Run ruby dk.rb review
Run ruby dk.rb install
Where did you create your application? If you look at your command line, you are in your Desktop. You need to switch directories to your project folder to be in the right context.
Additionally, you need to install build tools to install json native extensions.
Please refer to/follow instructions from this other stack overflow answer - The 'json' native gem requires installed build tools.
As the error suggest you have to update your PATH to include build tools also known as DevKit.
If you have used RailsInstaller to install ruby on rails on your computer then it has already included in your rails installation directory. All you have to do now is to update your PATH to include it. See step 4 of instruction in DevKit Overview on Github.
If not follow above instruction to install DevKit and then get to work.
Try follow this step and one more thing, if you use x64 of ruby installer, then please use x64 devkit. Same applied to x86. I'm facing this issues and the link gave it(step to install) to you save my time. Hope this helped.
p/s : if i'm correct in windows, ruby v2.2 above was't support higher nokogiri, to get things working properly use either ruby v1.9.3 or v2.1.6.
Check this link also for nokogiri supported.
I seem to have a conflict when trying to install Rails on Mountain Lion. I have tried updating Ruby but this did not help. I also tried Rails Installer but that also gave an error. Ruby version is 1.8.7
Here is the error I am getting from terminal
sudo gem install rails
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/atomic-1.1.10 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/atomic-1.1.10/ext/gem_make.out
I was having the same issues and I had all the requirements. My solution? Upgraded (through RVM) my version of Ruby from 2.0.0-p195 to 2.0.0-p353. After this I tried gem install rails and it worked like it was supposed to.
I installed the x-code command line tools and then the rails install worked correctly.
Use RailsInstaller and these step-by-step instructions:
I found the answer here, http://net.tutsplus.com/tutorials/ruby/how-to-install-ruby-on-a-mac/
Although by no means was this a walk in the park, due to version conflicts, the tut is over a year old and Rails now requires at least Ruby 1.9.3 and you need to install Command Line tools in Xcode. This tut uses RVM.
I tried Rails Installer which sounds a lot easier than doing it this way but that also gave me an error. I think I had major version conflicts going on. If you are trying to install Rails then I'd try Rails Installer first. Here's a very recent tut on installing it, http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac
I recently bought a macbook pro and downloaded the Mac OS mountain lion. I was told that ruby was already pre installed and that to download rails, I would type:
$ sudo gem install rails
However, when I do this, I get this error:
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.7.5 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.7.5/ext/json/ext/generator/gem_make.out
I have looked around stackoverflow for answers and tried downloading Xcode version 4.4.1, except $ sudo gem install rails still doesn't work. Also, when I try the command without sudo, it tells me:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.
Is there a solution to fixing this problem? Other people have mentioned something called rvm, except I don't really know what that is or how to use it.
Had a similar problem on same system as above. Xcode doesn't include the command line tools pre installed. To install these, go to preferences -> downloads section and select components, then download command line tools. This may or may not solved the above problem.
RVM allows you to switch between Ruby versions. You may not want to develop RoR apps with the default Ruby on Mountain Lion, and rather than replacing the system installed ruby, RVM allows you to use other (ie later) Ruby versions without impacting your base installed Ruby that comes with OS X.
I have previously used this as a guide when setting up Ruby On Rails under OS X:
http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac
I know other people have asked this but the suggested fixes don't seem to work for me. I'm trying to install Rails v. 3.2.3 on a Mac OS X Lion, using Ruby 1.8.7. In terminal:
$ sudo gem install rails -v 3.2.3
And then I get the error message:
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.7.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.7.0/ext/json/ext/parser/gem_make.out
I've seen some people suggest installing Xcode v. 4.3.2, which I have, but I'm not sure if I need to do something special with Xcode to get the Rails installation to work. Any help is appreciated.
The easiest install way is by using RVM
here is a pretty good guide:
http://thinkvitamin.com/code/ruby-on-rails/installing-ruby-rails-and-mysql-on-os-x-lion/