Installed rubyinstaller-1.8.7-p358.exe, then tried to install jammit, but the config.gem command isn't being recognized. Interestingly I have no file called environment.rb on my drive.
Also I've never used ruby :D
H:\>gem install jammit
Fetching: Platform-0.4.0.gem (100%)
WARNING: Platform-0.4.0 has an invalid nil value for #cert_chain
Fetching: open4-1.3.0.gem (100%)
Fetching: POpen4-0.1.4.gem (100%)
Fetching: yui-compressor-0.9.6.gem (100%)
Fetching: jammit-0.6.5.gem (100%)
Successfully installed Platform-0.4.0
Successfully installed open4-1.3.0
Successfully installed POpen4-0.1.4
Successfully installed yui-compressor-0.9.6
Successfully installed jammit-0.6.5
5 gems installed
Installing ri documentation for Platform-0.4.0...
Installing ri documentation for open4-1.3.0...
Installing ri documentation for POpen4-0.1.4...
Installing ri documentation for yui-compressor-0.9.6...
Installing ri documentation for jammit-0.6.5...
Installing RDoc documentation for Platform-0.4.0...
Installing RDoc documentation for open4-1.3.0...
Installing RDoc documentation for POpen4-0.1.4...
Installing RDoc documentation for yui-compressor-0.9.6...
Installing RDoc documentation for jammit-0.6.5...
H:\>config.gem "jammit"
'config.gem' is not recognized as an internal or external command,
operable program or batch file.
H:\>
First you need to create a Rails app before you can do:
Add the gem to Rails' environment.rb inside of the initializer:
config.gem "jammit"
config.gem is not a command rahter it is an entry in the environment.rb file.
To create a rails app go to your source folder and do:
rails new <app_name> # replace <app_name> with whatever you want to call your app
It will create a barebones rails app in a folder with the name that you chose for the app. Inside that folder you will find a config folder and in that folder you will see 'environment.rb`
Related
I am new to ruby and just tried installing rails and with the following error in code below.
Ruby is installed with the following version:
ruby 2.4.4p296 (2018-03-28 revision 63013) [x64-mingw32]
sqlite3 is installed with the following verions:
3.24.0 2018-06-04 19:24:41 c7ee0833225bfd8c5ec2f9bf62b97c4e04d03bd9566366d5221ac8fb199a87ca
I am assuming (from reading other questions with the same issue) that my PATH is messy. Keep in mind, I am new at ruby and don't know exactly, but i read that a messy path can be the reason.
I have installed both ruby and sqlite3 on my D: drive.
My Environment Variables> system variables> PATH, currently have 22 different folders/paths within it. I am not sure if this is the best way to do it, but its how it is.
Things I've tried:
installing rails from from C: instead of D: with the same error code.
updating gem with
gem update --system
I'm sure someone who knows much more than I do about how this works will have an easy fix for this.
Path Value under System Variables:
C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%SYSTEMROOT%\System32\OpenSSH\;D:\Programs\QuickTime\QTSystem\;D:\Programming\Ruby Installer\Ruby24-x64\bin;D:\Programming\sqlite3;D:\Programming;
Here are my PATH value under User variabled for [name]:
D:\Programming\Ruby Installer\Ruby24-x64\bin;C:\Users\jorda\AppData\Local\Microsoft\WindowsApps;C:\Users\jorda\AppData\Local\atom\bin;D:\Programming\sqlite3;D:\Programming;
Here's the error code i am receiving:
D:\>gem install rails
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: D:/Programming/Ruby Installer/Ruby24-
x64/lib/ruby/gems/2.4.0/gems/websocket-driver-0.7.0/ext/websocket-driver
"D:/Programming/Ruby Installer/Ruby24-x64/bin/ruby.exe" -r
./siteconf20180813-11328-m03y6e.rb extconf.rb
creating Makefile
current directory: D:/Programming/Ruby Installer/Ruby24-
x64/lib/ruby/gems/2.4.0/gems/websocket-driver-0.7.0/ext/websocket-driver
make "DESTDIR=" clean
Makefile:267: *** multiple target patterns. Stop.
current directory: D:/Programming/Ruby Installer/Ruby24-
x64/lib/ruby/gems/2.4.0/gems/websocket-driver-0.7.0/ext/websocket-driver
make "DESTDIR="
Makefile:267: *** multiple target patterns. Stop.
make failed, exit code 2
Gem files will remain installed in D:/Programming/Ruby Installer/Ruby24-
x64/lib/ruby/gems/2.4.0/gems/websocket-driver-0.7.0 for inspection.
Results logged to D:/Programming/Ruby Installer/Ruby24-
x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/websocket-driver-
0.7.0/gem_make.out
D:\>rails --version
'rails' is not recognized as an internal or external command,
operable program or batch file.
Using Windows 10
Installed ruby with dev kit
This may help as well
My current gem version:
D:\>gem --version
2.6.14.1
Thank you anyone who is taking the time to read this and help me. I am grateful for all communities and really appreciate it!
Also, Python is installed as well.
Um yeah so i did this:
Uninstalled Ruby. then used http://railsinstaller.org/en to re install ruby
Then re did the process: and heres the CMD
Microsoft Windows [Version 10.0.17134.165]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\jorda>ruby --v
ruby: invalid option --v (-h will show valid options) (RuntimeError)
C:\Users\jorda>ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
C:\Users\jorda>sqlite3 --version
3.24.0 2018-06-04 19:24:41
c7ee0833225bfd8c5ec2f9bf62b97c4e04d03bd9566366d5221ac8fb199a87ca
C:\Users\jorda>gem install rails
Fetching: activesupport-5.2.1.gem (100%)
Successfully installed activesupport-5.2.1
Fetching: actionview-5.2.1.gem (100%)
Successfully installed actionview-5.2.1
Fetching: actionpack-5.2.1.gem (100%)
Successfully installed actionpack-5.2.1
Fetching: activemodel-5.2.1.gem (100%)
Successfully installed activemodel-5.2.1
Fetching: arel-9.0.0.gem (100%)
Successfully installed arel-9.0.0
Fetching: activerecord-5.2.1.gem (100%)
Successfully installed activerecord-5.2.1
Fetching: activejob-5.2.1.gem (100%)
Successfully installed activejob-5.2.1
Fetching: actionmailer-5.2.1.gem (100%)
Successfully installed actionmailer-5.2.1
Fetching: actioncable-5.2.1.gem (100%)
Successfully installed actioncable-5.2.1
Fetching: mimemagic-0.3.2.gem (100%)
Successfully installed mimemagic-0.3.2
Fetching: marcel-0.3.2.gem (100%)
Successfully installed marcel-0.3.2
Fetching: activestorage-5.2.1.gem (100%)
Successfully installed activestorage-5.2.1
Fetching: railties-5.2.1.gem (100%)
Successfully installed railties-5.2.1
Fetching: rails-5.2.1.gem (100%)
Successfully installed rails-5.2.1
Parsing documentation for activesupport-5.2.1
Installing ri documentation for activesupport-5.2.1
Parsing documentation for actionview-5.2.1
Installing ri documentation for actionview-5.2.1
Parsing documentation for actionpack-5.2.1
Installing ri documentation for actionpack-5.2.1
Parsing documentation for activemodel-5.2.1
Installing ri documentation for activemodel-5.2.1
Parsing documentation for arel-9.0.0
Installing ri documentation for arel-9.0.0
Parsing documentation for activerecord-5.2.1
Installing ri documentation for activerecord-5.2.1
Parsing documentation for activejob-5.2.1
Installing ri documentation for activejob-5.2.1
Parsing documentation for actionmailer-5.2.1
Installing ri documentation for actionmailer-5.2.1
Parsing documentation for actioncable-5.2.1
Installing ri documentation for actioncable-5.2.1
Parsing documentation for mimemagic-0.3.2
Installing ri documentation for mimemagic-0.3.2
Parsing documentation for marcel-0.3.2
Installing ri documentation for marcel-0.3.2
Parsing documentation for activestorage-5.2.1
Installing ri documentation for activestorage-5.2.1
Parsing documentation for railties-5.2.1
Installing ri documentation for railties-5.2.1
Parsing documentation for rails-5.2.1
Installing ri documentation for rails-5.2.1
Done installing documentation for activesupport, actionview, actionpack, activemodel,
arel, activerecord, activejob, actionmailer, actioncable, mimemagic, marcel,
activestorage, railties, rails after 43 seconds
14 gems installed
C:\Users\jorda>ruby
If anyone is having the same issue, well, here you go.
You can try from this link to install rails in windows 10.
https://gorails.com/setup/windows/10
I downloaded the MSCollectionViewCalendarLayout and now I wanted to try out the example. If I open the Example.xcodeproj I only get errors e.g.
Lexical or Preprocessor Issue 'RestKit/RestKit.h' file not found
I tried the tip from the troubleshooting guide to change the project settings but it didn't worked. If I open the Example.xcworkspace I also only get errors.
Seems that the libraries are outdated. Is there a chance to get this project running?
Edit:
Now I tried to install cocoapods. I created a .profile file in my home directory (where Documents, Desktop, Downloads resides in). I put this text into the file
export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH
and then I run
gem install cocoapods --user-install
Because he didn't do something (was in the next line in terminal) I pressed q. Then he did something and I got the following warning
WARNING: You don't have /Users/my-user/.gem/ruby/2.0.0/bin in your
PATH, gem executables will not run.
Full output of terminal
Fetching: i18n-0.7.0.gem (100%)
WARNING: You don't have /Users/my-user/.gem/ruby/2.0.0/bin in your PATH,
gem executables will not run.
qSuccessfully installed i18n-0.7.0
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: minitest-5.6.1.gem (100%)
Successfully installed minitest-5.6.1
Fetching: activesupport-4.2.1.gem (100%)
Successfully installed activesupport-4.2.1
Fetching: nap-0.8.0.gem (100%)
Successfully installed nap-0.8.0
Fetching: fuzzy_match-2.0.4.gem (100%)
Successfully installed fuzzy_match-2.0.4
Fetching: cocoapods-core-0.37.1.gem (100%)
Successfully installed cocoapods-core-0.37.1
Fetching: claide-0.8.1.gem (100%)
Successfully installed claide-0.8.1
Fetching: colored-1.2.gem (100%)
Successfully installed colored-1.2
Fetching: xcodeproj-0.24.1.gem (100%)
Successfully installed xcodeproj-0.24.1
Fetching: cocoapods-downloader-0.9.0.gem (100%)
Successfully installed cocoapods-downloader-0.9.0
Fetching: cocoapods-plugins-0.4.2.gem (100%)
Successfully installed cocoapods-plugins-0.4.2
Fetching: cocoapods-try-0.4.4.gem (100%)
Successfully installed cocoapods-try-0.4.4
Fetching: netrc-0.7.8.gem (100%)
Successfully installed netrc-0.7.8
Fetching: cocoapods-trunk-0.6.0.gem (100%)
Successfully installed cocoapods-trunk-0.6.0
Fetching: molinillo-0.2.3.gem (100%)
Successfully installed molinillo-0.2.3
Fetching: escape-0.0.4.gem (100%)
Successfully installed escape-0.0.4
Fetching: cocoapods-0.37.1.gem (100%)
Successfully installed cocoapods-0.37.1
Parsing documentation for i18n-0.7.0
Installing ri documentation for i18n-0.7.0
Parsing documentation for thread_safe-0.3.5
Installing ri documentation for thread_safe-0.3.5
Parsing documentation for tzinfo-1.2.2
Installing ri documentation for tzinfo-1.2.2
Parsing documentation for minitest-5.6.1
Installing ri documentation for minitest-5.6.1
Parsing documentation for activesupport-4.2.1
unable to convert "\x84" from ASCII-8BIT to UTF-8 for lib/active_support/values/unicode_tables.dat, skipping
Installing ri documentation for activesupport-4.2.1
Parsing documentation for nap-0.8.0
Installing ri documentation for nap-0.8.0
Parsing documentation for fuzzy_match-2.0.4
Installing ri documentation for fuzzy_match-2.0.4
Parsing documentation for cocoapods-core-0.37.1
Installing ri documentation for cocoapods-core-0.37.1
Parsing documentation for claide-0.8.1
Installing ri documentation for claide-0.8.1
Parsing documentation for colored-1.2
Installing ri documentation for colored-1.2
Parsing documentation for xcodeproj-0.24.1
Installing ri documentation for xcodeproj-0.24.1
Parsing documentation for cocoapods-downloader-0.9.0
Installing ri documentation for cocoapods-downloader-0.9.0
Parsing documentation for cocoapods-plugins-0.4.2
Installing ri documentation for cocoapods-plugins-0.4.2
Parsing documentation for cocoapods-try-0.4.4
Installing ri documentation for cocoapods-try-0.4.4
Parsing documentation for netrc-0.7.8
Installing ri documentation for netrc-0.7.8
Parsing documentation for cocoapods-trunk-0.6.0
Installing ri documentation for cocoapods-trunk-0.6.0
Parsing documentation for molinillo-0.2.3
Installing ri documentation for molinillo-0.2.3
Parsing documentation for escape-0.0.4
Installing ri documentation for escape-0.0.4
Parsing documentation for cocoapods-0.37.1
Installing ri documentation for cocoapods-0.37.1
19 gems installed
Then I reopened the Xcode example, but I'm still getting the error that RestKit.h can't be found. What I'm doing wrong?
Edit 2:
Now I tried to use pod install in the example directory, but the pod command was not found. So I edited the PATH in .profile to this
export PATH=$GEM_HOME/ruby/2.0.0/bin:$PATH
Then I restarted terminal and run the command again
Analyzing dependencies
Creating shallow clone of spec repo `master` from `https://github.com/CocoaPods/Specs.git`
Fetching podspec for `MSCollectionViewCalendarLayout` from `../`
Downloading dependencies
Installing AFNetworking 1.3.3 (was 1.3.3)
Installing CupertinoYankee 0.1.1 (was 0.1.1)
Installing ISO8601DateFormatterValueTransformer (0.5.0)
Using MSCollectionViewCalendarLayout (0.1.3)
Installing Masonry 0.4.0 (was 0.4.0)
Installing RKValueTransformers (1.0.1)
Installing RestKit 0.22.0 (was 0.22.0)
Installing SOCKit 1.1 (was 1.1)
Installing TransitionKit 2.0.0 (was 2.0.0)
Installing UIColor-HexString (1.0.1)
Generating Pods project
Integrating client project
Afterwards I opened Example.xcworkspace and got the error described by Jakub Vano. Then I unlocked and edited the MASUtilities.h according to this link (commented enum and added the static const).
Now I got the project running!
You need to re-install CocoaPods for Example project:
run pod install in the Example project directory
run the project from the .xcworkspace
There will still be compile errors caused by known issue with Masonry - as mentioned on linked issue, workaround is to replace problematic enum with
typedef float MASLayoutPriority;
static const MASLayoutPriority MASLayoutPriorityRequired = UILayoutPriorityRequired;
static const MASLayoutPriority MASLayoutPriorityDefaultHigh = UILayoutPriorityDefaultHigh;
static const MASLayoutPriority MASLayoutPriorityDefaultMedium = 500;
static const MASLayoutPriority MASLayoutPriorityDefaultLow = UILayoutPriorityDefaultLow;
static const MASLayoutPriority MASLayoutPriorityFittingSizeLevel = UILayoutPriorityFittingSizeLevel;
I've recently updated to Mountain Lion and re-installed Ruby, but when I try to run a test Rails app, I get an error message that says that "Rails is not currently installed" on my system. I do what it says, type sudo gem install rails and get:
cleared faster_require caches due to new gem install...
Successfully installed rails-3.2.7
1 gem installed
Installing ri documentation for rails-3.2.7...
Installing RDoc documentation for rails-3.2.7...
But when I check to see which rails version is install, here is what I get:
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.
I've also tried gem install rails and get:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/aileen/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
creating Makefile
make
compiling generator.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [generator.o] Error 1
Gem files will remain installed in /Users/aileen/.rvm/gems/ruby-1.9.3-p194#rails327/gems/json-1.7.4 for inspection.
Results logged to /Users/aileen/.rvm/gems/ruby-1.9.3-p194#rails327/gems/json-1.7.4/ext/json/ext/generator/gem_make.out
I see that you are using ruby 1.9.3 using rvm on OS X 10.8.2 (Mountain lion)
It's possible that some gems referenced by rails need gcc-4.2 in /usr/bin to build native estension.
In Mountain Lion , even after installing Xcode 4.5 CLI tools ( opening the menu XCode - Preferences..Download -> Command Line Tools ) you get /usr/bin/gcc but not /usr/bin/gcc-4.2; unfortunately the build process of some native extension relies on /usr/bin/gcc-4.2
However I just installed rails smoothly on an environment such as your.
I previously fixed the environment as discussed in the Carina C. Zona's blog post: Fix for “make: /usr/bin/gcc-4.2: No such file or directory”, that is:
make sure you have installed Homebrew
brew --version
should report 0.9.3 or greater
if you have not brew than follow these instrunctions to install it
if you have a older version then update it:
brew update
now you can install gcc-4.2 and create a symbolink link where is aspected by the build system
brew tap homebrew/dupes
brew install apple-gcc42
sudo ln -s /usr/local/bin/gcc-4.2 /usr/bin/gcc-4.2
now you're ready to successfully install rails
gem install rails
You should get output something like this
Fetching: i18n-0.6.1.gem (100%)
Fetching: activesupport-3.2.8.gem (100%)
Fetching: builder-3.0.4.gem (100%)
Fetching: activemodel-3.2.8.gem (100%)
Fetching: rack-cache-1.2.gem (100%)
Fetching: rack-test-0.6.2.gem (100%)
Fetching: journey-1.0.4.gem (100%)
Fetching: hike-1.2.1.gem (100%)
Fetching: sprockets-2.1.3.gem (100%)
Fetching: erubis-2.7.0.gem (100%)
Fetching: actionpack-3.2.8.gem (100%)
Fetching: arel-3.0.2.gem (100%)
Fetching: tzinfo-0.3.34.gem (100%)
Fetching: activerecord-3.2.8.gem (100%)
Fetching: activeresource-3.2.8.gem (100%)
Fetching: polyglot-0.3.3.gem (100%)
Fetching: treetop-1.4.12.gem (100%)
Fetching: mail-2.4.4.gem (100%)
Fetching: actionmailer-3.2.8.gem (100%)
Fetching: rack-ssl-1.3.2.gem (100%)
Fetching: railties-3.2.8.gem (100%)
Fetching: rails-3.2.8.gem (100%)
Successfully installed i18n-0.6.1
Successfully installed activesupport-3.2.8
Successfully installed builder-3.0.4
Successfully installed activemodel-3.2.8
Successfully installed rack-cache-1.2
Successfully installed rack-test-0.6.2
Successfully installed journey-1.0.4
Successfully installed hike-1.2.1
Successfully installed sprockets-2.1.3
Successfully installed erubis-2.7.0
Successfully installed actionpack-3.2.8
Successfully installed arel-3.0.2
Successfully installed tzinfo-0.3.34
Successfully installed activerecord-3.2.8
Successfully installed activeresource-3.2.8
Successfully installed polyglot-0.3.3
Successfully installed treetop-1.4.12
Successfully installed mail-2.4.4
Successfully installed actionmailer-3.2.8
Successfully installed rack-ssl-1.3.2
Successfully installed railties-3.2.8
Successfully installed rails-3.2.8
22 gems installed
Installing ri documentation for i18n-0.6.1...
Building YARD (yri) index for i18n-0.6.1...
Installing ri documentation for activesupport-3.2.8...
Building YARD (yri) index for activesupport-3.2.8...
Installing ri documentation for builder-3.0.4...
Building YARD (yri) index for builder-3.0.4...
Installing ri documentation for activemodel-3.2.8...
Building YARD (yri) index for activemodel-3.2.8...
Installing ri documentation for rack-cache-1.2...
Building YARD (yri) index for rack-cache-1.2...
Installing ri documentation for rack-test-0.6.2...
Building YARD (yri) index for rack-test-0.6.2...
Installing ri documentation for journey-1.0.4...
Building YARD (yri) index for journey-1.0.4...
Installing ri documentation for hike-1.2.1...
Building YARD (yri) index for hike-1.2.1...
Installing ri documentation for sprockets-2.1.3...
Building YARD (yri) index for sprockets-2.1.3...
Installing ri documentation for erubis-2.7.0...
Building YARD (yri) index for erubis-2.7.0...
Installing ri documentation for actionpack-3.2.8...
Building YARD (yri) index for actionpack-3.2.8...
Installing ri documentation for arel-3.0.2...
Building YARD (yri) index for arel-3.0.2...
Installing ri documentation for tzinfo-0.3.34...
Building YARD (yri) index for tzinfo-0.3.34...
Installing ri documentation for activerecord-3.2.8...
Building YARD (yri) index for activerecord-3.2.8...
Installing ri documentation for activeresource-3.2.8...
Building YARD (yri) index for activeresource-3.2.8...
Installing ri documentation for polyglot-0.3.3...
Building YARD (yri) index for polyglot-0.3.3...
Installing ri documentation for treetop-1.4.12...
Building YARD (yri) index for treetop-1.4.12...
Installing ri documentation for mail-2.4.4...
Building YARD (yri) index for mail-2.4.4...
Installing ri documentation for actionmailer-3.2.8...
Building YARD (yri) index for actionmailer-3.2.8...
Installing ri documentation for rack-ssl-1.3.2...
Building YARD (yri) index for rack-ssl-1.3.2...
Installing ri documentation for railties-3.2.8...
Building YARD (yri) index for railties-3.2.8...
Installing ri documentation for rails-3.2.8...
Building YARD (yri) index for rails-3.2.8...
Installing RDoc documentation for i18n-0.6.1...
Installing RDoc documentation for activesupport-3.2.8...
Installing RDoc documentation for builder-3.0.4...
Installing RDoc documentation for activemodel-3.2.8...
Installing RDoc documentation for rack-cache-1.2...
Installing RDoc documentation for rack-test-0.6.2...
Installing RDoc documentation for journey-1.0.4...
Installing RDoc documentation for hike-1.2.1...
Installing RDoc documentation for sprockets-2.1.3...
Installing RDoc documentation for erubis-2.7.0...
Installing RDoc documentation for actionpack-3.2.8...
Installing RDoc documentation for arel-3.0.2...
Installing RDoc documentation for tzinfo-0.3.34...
Installing RDoc documentation for activerecord-3.2.8...
Installing RDoc documentation for activeresource-3.2.8...
Installing RDoc documentation for polyglot-0.3.3...
Installing RDoc documentation for treetop-1.4.12...
Installing RDoc documentation for mail-2.4.4...
Installing RDoc documentation for actionmailer-3.2.8...
Installing RDoc documentation for rack-ssl-1.3.2...
Installing RDoc documentation for railties-3.2.8...
Installing RDoc documentation for rails-3.2.8...
#Franco is correct: the "native extension" build scripts expect /usr/bin/gcc-4.2, which does not exist in OS X Mountain Lion.
If you upgraded to Mountain Lion from a prevoius OS X version, then you may already have gcc. In that case, just create a symlink to gcc: sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
If you have a fresh install of Mountain Lion, then you may not have gcc at all. In that case, you would need to install gcc as #Franco explains.
This is not specifically a "rails" gem issue. Any gem that builds "native extensions" fails:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. [...]
You have to install development tools first.
In my case, I was trying to install octopress, which depends on something called RedCloth.
I ran into this issue as well, with Mountain Lion. The gem that was failing installation was json. To fix it, I installed the xcode CLI tools and then just symlinked the installed gcc (i686-apple-darwin11-llvm-gcc-4.2) as /usr/bin/gcc-4.2. Once this was done, it just worked.
While trying to install another gem, I ran into a similar issue where the native build step complained about missing g++-4.2. I symlinked this exactly the same as I did with gcc-4.2 above, and it worked.
UPDATE: OSX Mavericks with latest RVM
With the latest OSX 10.9 and latest RVM, these issues seem to have gone away. So, time to upgrade.
Try working through this first
He assumes you already have homebrew. If you don't you can get it from here
% gem install searchlogic -v2.4.28
Fetching: arel-2.2.1.gem (100%)
Fetching: tzinfo-0.3.31.gem (100%)
Successfully installed activemodel-3.1.3
Successfully installed arel-2.2.1
Successfully installed tzinfo-0.3.31
3 gems installed
Installing ri documentation for activemodel-3.1.3...
Installing ri documentation for arel-2.2.1...
Installing ri documentation for tzinfo-0.3.31...
Installing RDoc documentation for activemodel-3.1.3...
Installing RDoc documentation for arel-2.2.1...
Installing RDoc documentation for tzinfo-0.3.31...
.... what is going on here?
shouldn't search logic be installed, and not these... gems I don't need?
This looks like it's installing the dependencies for the gem, as it depends on activerecord and these are the dependencies for the activerecord gem. You should check to see if the gem is not already installed.
something like this:
gem install rails
Fetching: activesupport-3.0.10.gem (100%)
Fetching: builder-2.1.2.gem (100%)
WARNING: builder-2.1.2 has an invalid nil value for #cert_chain
Fetching: i18n-0.5.0.gem (100%)
Fetching: activemodel-3.0.10.gem (100%)
Fetching: rack-1.2.3.gem (100%)
Fetching: rack-test-0.5.7.gem (100%)
Fetching: rack-mount-0.6.14.gem (100%)
Fetching: tzinfo-0.3.29.gem (100%)
Fetching: abstract-1.0.0.gem (100%)
WARNING: abstract-1.0.0 has an invalid nil value for #cert_chain
Fetching: erubis-2.6.6.gem (100%)
Fetching: actionpack-3.0.10.gem (100%)
Fetching: arel-2.0.10.gem (100%)
Fetching: activerecord-3.0.10.gem (100%)
Fetching: activeresource-3.0.10.gem (100%)
Fetching: mime-types-1.16.gem (100%)
Fetching: polyglot-0.3.2.gem (100%)
Fetching: treetop-1.4.10.gem (100%)
Fetching: mail-2.2.19.gem (100%)
Fetching: actionmailer-3.0.10.gem (100%)
Fetching: thor-0.14.6.gem (100%)
Fetching: railties-3.0.10.gem (100%)
Fetching: bundler-1.0.18.gem (100%)
Fetching: rails-3.0.10.gem (100%)
Successfully installed activesupport-3.0.10
Successfully installed builder-2.1.2
Successfully installed i18n-0.5.0
Successfully installed activemodel-3.0.10
Successfully installed rack-1.2.3
Successfully installed rack-test-0.5.7
Successfully installed rack-mount-0.6.14
Successfully installed tzinfo-0.3.29
Successfully installed abstract-1.0.0
Successfully installed erubis-2.6.6
Successfully installed actionpack-3.0.10
Successfully installed arel-2.0.10
Successfully installed activerecord-3.0.10
Successfully installed activeresource-3.0.10
Successfully installed mime-types-1.16
Successfully installed polyglot-0.3.2
Successfully installed treetop-1.4.10
Successfully installed mail-2.2.19
Successfully installed actionmailer-3.0.10
Successfully installed thor-0.14.6
Successfully installed railties-3.0.10
Successfully installed bundler-1.0.18
Successfully installed rails-3.0.10
23 gems installed
Installing ri documentation for activesupport-3.0.10...
Installing ri documentation for builder-2.1.2...
unable to convert "\xF1" from ASCII-8BIT to UTF-8 for README, skipping
Installing ri documentation for i18n-0.5.0...
Installing ri documentation for activemodel-3.0.10...
Installing ri documentation for rack-1.2.3...
Installing ri documentation for rack-test-0.5.7...
Installing ri documentation for rack-mount-0.6.14...
Installing ri documentation for tzinfo-0.3.29...
Installing ri documentation for abstract-1.0.0...
Installing ri documentation for erubis-2.6.6...
Installing ri documentation for actionpack-3.0.10...
Installing ri documentation for arel-2.0.10...
Installing ri documentation for activerecord-3.0.10...
Installing ri documentation for activeresource-3.0.10...
Installing ri documentation for mime-types-1.16...
Installing ri documentation for polyglot-0.3.2...
Installing ri documentation for treetop-1.4.10...
Installing ri documentation for mail-2.2.19...
Installing ri documentation for actionmailer-3.0.10...
Installing ri documentation for thor-0.14.6...
Installing ri documentation for railties-3.0.10...
Installing ri documentation for bundler-1.0.18...
Installing ri documentation for rails-3.0.10...
file 'lib' not found
Installing RDoc documentation for activesupport-3.0.10...
Installing RDoc documentation for builder-2.1.2...
unable to convert "\xF1" from ASCII-8BIT to UTF-8 for README, skipping
Installing RDoc documentation for i18n-0.5.0...
Installing RDoc documentation for activemodel-3.0.10...
Installing RDoc documentation for rack-1.2.3...
Installing RDoc documentation for rack-test-0.5.7...
Installing RDoc documentation for rack-mount-0.6.14...
Installing RDoc documentation for tzinfo-0.3.29...
Installing RDoc documentation for abstract-1.0.0...
Installing RDoc documentation for erubis-2.6.6...
Installing RDoc documentation for actionpack-3.0.10...
Installing RDoc documentation for arel-2.0.10...
Installing RDoc documentation for activerecord-3.0.10...
Installing RDoc documentation for activeresource-3.0.10...
Installing RDoc documentation for mime-types-1.16...
Installing RDoc documentation for polyglot-0.3.2...
Installing RDoc documentation for treetop-1.4.10...
Installing RDoc documentation for mail-2.2.19...
Installing RDoc documentation for actionmailer-3.0.10...
Installing RDoc documentation for thor-0.14.6...
Installing RDoc documentation for railties-3.0.10...
Installing RDoc documentation for bundler-1.0.18...
Installing RDoc documentation for rails-3.0.10...
file 'lib' not found
and if i run rake db:migrate
it says:
............
rake aborted!
stack level too deep
try this :
sudo gem install rails --no-ri --no-rdoc
and if you want to install RDoc use :
sudo gem install rdoc-data
sudo rdoc-data --install
sudo gem rdoc --all --overwrite
if that doesnt work try this :
sudo apt-get install ruby-dev build-essential
Note, the following also seems to work on Windows 7. (omit the "sudo")
gem install rails --no-ri --no-rdoc
I got similar with gem install rails (Ubuntu 12.04, with RVM)
Installing ri documentation for rails-3.2.13...
file 'lib' not found
Installing RDoc documentation for rails-3.2.13...
file 'lib' not found
installing RDoc and then reinstalling rails solved the problem for me. So:
gem install rdoc
gem install rails
This is still happening on rails-3.2.3.
What appears to work is to install rdoc first. So, with a freshly installed ruby, do:
gem install rdoc
gem install rails
It seems like there are some issues with ree and ruby 1.8.. If you have rvm try use ruby 1.9.2 or any 1.9.
then
gem install rails will work