Trouble with Ruby on Rails OS X 1.8.4 - ruby-on-rails

I am having trouble with Ruby on Rails on my Mac. It may have something to do either with my version of xCode or OS X 1.8.4. I say this because I was able to create Ruby on Rails apps in the past.
Here is my problem. When I run rails new rubyDemo to create a new Rails app I get the following error:
create
create README.rdoc
create Rakefile
create config.ru
...
...
Using execjs (2.0.1)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.3)
Installing json (1.8.0) with native extensions
Gem::Installer::ExtensionBuildError: 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 /Users/tithos/.bundler/tmp/9865/gems/json-1.8.0 for inspection.
Results logged to /Users/tithos/.bundler/tmp/9865/gems/json- 1.8.0/ext/json/ext/generator/gem_make.out
An error occured while installing json (1.8.0), and Bundler cannot continue.
When I try to run sudo gem install json -v '1.8.0'
I get the following error:
Building native extensions. This could take a while...
ERROR: Error installing json:
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.8.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
I am running:
ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
rails -v
Rails 3.2.13
I have no idea what other gems and/or pieces I am missing.
Any help would be great
P.S. sorry for the long post

Related

Bundle Install command won't install my gems?

Okay, so I'm very new to Rails, and am just beginning to feel my way around my new Linux operating system as well.
I'm currently doing a project for school, and I've followed all of the directions to perfection. For consistency purposes, they want specific versions of both rails and gemsets.
After I have initialized rails in my directory, I then run a
bundle install command, and have several installation issues which I are in the code block as follows:
user#user-ThinkPad-T430 ~/code/bloccit $ sudo bundle install
[sudo] password for user:
Don't run Bundler as root. Bundler can ask for sudo if it is needed,
and installing your bundle as root will break this application for all
non-root users on this machine.
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 12.3.0
Using concurrent-ruby 1.0.5
Installing json 1.8.6 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/json-
1.8.6/ext/json/ext/generator
/usr/bin/ruby2.3 -r ./siteconf20171128-11271-1ah858h.rb extconf.rb
mkmf.rb can't find header files for ruby at
/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/json-1.8.6
for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-
linux/2.3.0/json-1.8.6/gem_make.out
Using minitest 5.10.3
Using thread_safe 0.3.6
Using builder 3.2.3
Using erubis 2.7.0
Using mini_portile2 2.3.0
Using crass 1.0.3
Using rack 1.6.8
Using mini_mime 1.0.0
Using arel 6.0.4
Using bundler 1.11.2
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using thor 0.20.0
Installing ffi 1.9.18 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/ffi-1.9.18/ext/ffi_c
/usr/bin/ruby2.3 -r ./siteconf20171128-11271-1382ks7.rb extconf.rb
mkmf.rb can't find header files for ruby at
/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/ffi-1.9.18
for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-
linux/2.3.0/ffi-1.9.18/gem_make.out
Installing pg 0.21.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/pg-0.21.0/ext
/usr/bin/ruby2.3 -r ./siteconf20171128-11271-171n79p.rb extconf.rb
mkmf.rb can't find header files for ruby at
/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/pg-0.21.0
for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-
linux/2.3.0/pg-0.21.0/gem_make.out
Using rb-fsevent 0.10.2
Using tilt 2.0.8
Installing sqlite3 1.3.13 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3
/usr/bin/ruby2.3 -r ./siteconf20171128-11271-ml1ggl.rb extconf.rb
mkmf.rb can't find header files for ruby at
/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/sqlite3-
1.3.13 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-
linux/2.3.0/sqlite3-1.3.13/gem_make.out
Using turbolinks-source 5.0.3
Using i18n 0.9.1
An error occurred while installing json (1.8.6), and Bundler cannot
continue.
Make sure that `gem install json -v '1.8.6'` succeeds before bundling.
The main error seems to be the Gem::Ext::BuildError: ERROR: Failed to build gem native extension. line, but it's also having problems installing json within the bundler.
Any helpful advice or tips would be appreciated!
First of all follow the instruction (please avoid sudo):
Don't run Bundler as root. Bundler can ask for sudo if it is needed,
and installing your bundle as root will break this application for all
non-root users on this machine.
To resolve this issue in linux, run:
sudo apt install ruby2.3-dev
Cheers!

Can't create new rails project- ERROR: Failed to build gem native extension

I'm completely new to Ruby and Ruby on Rails, and trying to get my feet wet in it. Just installed Ruby and ROR on Win 10 64 bit, and from the command prompt seem successfully:
c:\>ruby -v
ruby 2.2.6p396 (2016-11-15 revision 56800) [x64-mingw32]
c:\>rails -v
Rails 5.0.1
However, I can't create a project, it returns the following:
c:\>rails new demo
Using tilt 2.0.5
Using sqlite3 1.3.13
Using turbolinks-source 5.0.0
Using tzinfo 1.2.2
Using nokogiri 1.7.0.1
Using rack-test 0.6.3
Using sprockets 3.7.1
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
C:/Ruby22-x64/bin/ruby.exe extconf.rb
C:/Ruby22-x64/bin/ruby.exe: No such file or directory -- extconf.rb (LoadError)
extconf failed, exit code 1
Gem files will remain installed in
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/nio4r-1.2.1 for inspection.
Results logged to
C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/nio4r-1.2.1/gem_make.out
An error occurred while installing nio4r (1.2.1), and Bundler cannot continue.
Make sure that `gem install nio4r -v '1.2.1'` succeeds before bundling.
So the two major errors seem to be:
1) Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
I thought that would be resolved by installing DevKit, at https://rubyinstaller.org/add-ons/devkit/ but no cigar
2) C:/Ruby22-x64/bin/ruby.exe extconf.rb
C:/Ruby22-x64/bin/ruby.exe: No such file or directory -- extconf.rb (LoadError)
I have no idea this error. C:/Ruby22-x64/bin/ruby.exe is the correct path to Ruby on my system. Can anyone shed some light?

Rails bundle failing while installing atomic

I'm just getting into ruby on rails, And I'm setting it up on a second windows computer.
I've used the most recent 'railsinstaller' using rails: 4.0.0 and ruby: 2.0.0p195
when I run rails new <project name> Rails creates the project but fails on the bundle step with the following error.
Installing atomic (1.1.14)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
D:/RailsInstaller/Ruby2.0.0/bin/ruby.exe extconf.rb
creating Makefile
Gem files will remain installed in D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/atomic-1.1.14 for inspection.
Results logged to D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/ext/gem_make.out
An error occurred while installing atomic (1.1.14), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.14'` succeeds before bundling.
I've tried a few things I've found on google such as updating gem and ruby but none of that worked... I'm too new to rails to figure this out myself, does anyone know what might be the problem?
EDIT
the outcome of gem install atomic -v '1.1.14'
D:\Programming\Ruby>gem install atomic -v '1.1.14'
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ConEmu blocks ANSICON injection
The system cannot find the file D:\ansicon\ansicon-master\ansicon.exe.
ERROR: Error installing atomic:
ERROR: Failed to build gem native extension.
D:/RailsInstaller/Ruby2.0.0/bin/ruby.exe extconf.rb
creating Makefile
Gem files will remain installed in D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/atomic-1.1.14 for inspection.
Results logged to D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/ext/gem_make.out
Thanks,
Peter McKinney

Rails is not creating a new app correctly - conflict with JSON 1.7.7?

I'm trying to learn Ruby on Rails with a online tutorial.
[rails version]: Rails 3.2.13
[ruby version] : ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]
When I execute the command:
rails new first_app
I get:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h
Gem files will remain installed in /home/philippe/.gem/ruby/1.9.1/gems/json-1.7.7 for inspection.
Results logged to /home/philippe/.gem/ruby/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.7'` succeeds before bundling.
Sure enough, I ran gem install json -v '1.7.7 as listed, however the results are:
[philippe#localhost rails_projects]$ gem install json -v '1.7.7'
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h
Gem files will remain installed in /home/philippe/.gem/ruby/1.9.1/gems/json-1.7.7 for inspection.
Results logged to /home/philippe/.gem/ruby/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out
Has anyone seen that?
If you are in a "rpm" system (Fedora or Red Hat) use:
sudo yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel
It solved the problem for me.

RMagick error installing Redmine on Windows

I'm trying to upgrade my Redmine installation to the latest.
I updated ruby, rails, and gem as required.
current trunk | ruby 1.8.7, 1.9.2, 1.9.3, jruby-1.6.7 | Rails 3.2.6 | RubyGems <= 1.8
Issuing the rake db:migrate command it gives me the following error:
C:\ruby-apps\RedMine>rake db:migrate RAILS_ENV=production
←[31mCould not find gem 'rmagick (>= 2.0.0) x86-mingw32' in the gems available on this machine.←[0m
←[33mRun bundle install to install missing gems.←[0m
So I installed rmagick for win32 and listing installed gems I see :
...
railties (3.2.6)
rake (0.9.2.2)
rdoc (3.12)
rmagick (2.12.0 mswin32)
ruby-openid (2.1.8)
rubygems-update (1.8.24)
...
But rake db:migrate still give me the same error, so I tried bundle install, but I get:
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for stdint.h... * 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.
Any ideas on how to get out of this?
I ran into the same problem while installing redmine. According to a comment in the Gemfile rmagick optional and only used to export Gant graphs as PNGs. So if you do not need this specific feature you can run
bundle install --without development test rmagick
Actually Bitnami's Redmine windows Installer contains a solution to this problem.
Using it, for me is a valid solution to the problem.
The content of the installation may be used to inspect correct versions and dependencies to correctly build Redmine.

Resources