Installation of Rails - ruby-on-rails

I tried to install Rails on OS X Lion using the following command in Terminal:
sudo gem install rails
But I am getting the following 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.6 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.7.6/ext/json/ext/generator/gem_make.out
Any help would be appreciated.

First install the Command Line Tools in the latest Xcode-Version.
and then run sudo gem install rails
To install Command Line Tools, go to XCode Preferences > Downloads.

Related

error installing rails on ubuntu 16.04 failed to build gem native extension

Here is the code I put in and then the error followed: I am currently figuring out rails headers and see what could be happening. I follwed this article https://gorails.com/setup/ubuntu/16.04
and this article: http://ryanbigg.com/2014/10/ubuntu-ruby-ruby-install-chruby-and-you
and nothing.
gem install rails
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /var/lib/gems/2.3.0 directory.
rickus#rickus:~$ sudo gem install rails
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/nokogiri-1.8.1/ext/nokogiri
/usr/bin/ruby2.3 -r ./siteconf20170928-18941-1fdewid.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/nokogiri-1.8.1 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.8.1/gem_make.out
Im also come up with this issue where I installed ruby environment manager rvm/ rbenv using sudo command.you can reinstall your ruby environment manager and avoid using sudo command or else all your gem installations would need sudo commands which you should avoid to prevent conflicts in the future.

Error installing gem twitter on Ubuntu 15.04

Am trying to install twitter gem on Ubuntu 15.04 and this error keeps popping up
gem install twitter
Building native extensions. This could take a while...
ERROR: Error installing twitter:
ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 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.1.0/gems/http_parser.rb-0.6.0 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86-linux/2.1.0/http_parser.rb-0.6.0/gem_make.out
You are getting this error because there is no ruby development environment installed. Development environment is needed to compile ruby extensions,
You should install development first using command below:
$ sudo apt-get install ruby-dev
I had a similar issue and i solved it by installing ruby-dev:
sudo apt-get install ruby-dev

Error installing rails, failed to build gem native extension

I know there is a couple of topics about that, but the reason I create a new one is that it still doesn't work for me ...
So here is my configuration :
ruby -v : 1.8.7
gem -v : 1.8.21
And when I try to make
sudo gem1.8 install rails
I have the following error :
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
creating Makefile
make
sh: make: not found
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/json-1.6.6 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/json-1.6.6/ext/json/ext/generator/gem_make.out
I'm running on Debian 6.0.4 Squeeze.
Thanks in advance for your answers !
You don't have make command, as your output says. In debian install package build-essential
I think gcc or c-compiler isn't install or not writen in environment path, I've got same problem while installing rails, but after Install gcc, I can install rails very well.

Why am I having a problem installing rmagick

On Ruby 1.8.7 and rails 2.3.5 I get:
gem install rmagick
ERROR: Error installing rmagick:
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/rmagick-2.13.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
Building native extensions. This could take a while...
Cynicalgrinch:levelous pawel$ gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
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/rmagick-2.13.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
Gem_make.out says this:
/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
on Ubuntu/Debian you would need to install:
sudo apt-get install libmagickwand-dev
on RedHat/Fedora/CentOS:
yum install ImageMagick-devel
To install rmagick with the gem system, you must have "imagemagick" on your system. The following error line says that rmagick failed to build because the native extension (imagemagick) does not exist on your system.
ERROR: Failed to build gem native extension.
On OSX, you can use brew (the best way in my opinion) to install imagemagick. Once brew is installed :
brew install imagemagick
gem install rmagick
On Mountain Lion (OSX), after:
brew install imagemagick
it may be necessary to force the re-creation of some symlinks manually before being able to install the rmagick gem.
> brew link -f jpeg
> brew link -f libpng
> brew link -f freetype
> brew link -f imagemagick
On fedora make sure you have ImageMagick-devel installed.

I was trying to install sqlite3 interface for ruby in my mac snow leopard 10.6.3. But i got the following error any suggestions?

for this command i got this error "sudo gem install sqlite3-ruby"
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
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/sqlite3-ruby-1.3.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/sqlite3-ruby-1.3.1/ext/sqlite3/gem_make.out
ruby -v 1.8.7
rails -v 3.0.1
gem -v 1.3.7
sqlite3 --version 3.6.12
If you have ports installed try:
port install sqlite
Or if you are using brew:
brew install sqlite
Does that fix it?

Resources