I am trying to install and get running Rails Starter kit. On running bundle install, I get the following :
Your Ruby version is 2.3.0, but your Gemfile specified 2.1.3
So I have changed this line to ruby '2.3.0' and try again the command : see here.
It seems like I am unaible to build the gem native extension, and I don't find any workaround.
Note 1 : I have tried with both 2.3 and 2.3.1.
Note 2 : I have RV.
Thanks!
I may be relating to the 'json' native extension compiling.
If you're on Mac ensure you've Xcode developer kit installed. On Linux, a workaround is to have libgmp3-dev library installed (sudo apt-get install libgmp3-dev) as indicated in this issue.
For Windows users, DevKit is needed.
Related
I have read the related answers, but the content is too complicated and I am not sure how to do it.
Since I inherited an old project, I need to use Ruby version 2.3.1, I cannot install the latest version of Ruby, nor can I install the latest version of Rails (must match the Ruby version).
I installed Rails under the following instructions on the MacOS terminal:
gem install rails -v 4.2.2
But after a few lines of messages, an error message appears as follows
While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.
I'm not sure if I chose the wrong version of Rails, or there are other operational errors. Please tell me what should I do?
I just moved from Windows to MacOS.
I added "--user-install" at the end of the original instruction to proceed to the next step:
gem install rails -v 4.2.2 --user-install
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 trying to install rails on my mac, but every time I type sudo gem install rails into the command line, I get the following error message. I have been stuck for a while, hope you can help.
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/2.0/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/atomic-1.1.14 for inspection
Results logged to /Library/Ruby/Gems/2.0.0/gems/atomic-1.1.14/ext/gem_make.out
If you are trying to install Rails 4.0, it needs RubyGems 2.0.3, so you have to update your system by using following command
gem update --system 2.0.3
and then continue with your installation.
Hope it helped
I would just use rvm. It should work like a charm. Or you could dig around and see if you can find that ruby.h file its talking about. But I personally think the latter would be a pain in the ass.
Upgrade xcode by typing following command in terminal window-
xcode-select --install
This should solve your isssu.
yea the rvm works like a charm and it will come in handy when you want to switch between different rails versions
I had the same issues. I upgraded my version (using RVM) of Ruby from 2.0.0-p195 to 2.0.0-p353 (make sure you tell RVM to use the new version as the default). After this I did gem install rails again and it worked fine.
Make sure you have installed the right version of DevKit, you can get it from here...
http://rubyinstaller.org/downloads/
and install as it says here:
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit#installation-instructions
if you still have the problem even after Upgrading Xcode.
Its may be because :
The Apple LLVM compiler in Xcode 5.1 treats unrecognized command-line options as errors. This issue has been seen when building both Python native extensions and Ruby Gems, where some invalid compiler options are currently specified.
To workaround this issue, set the ARCHFLAGS environment variable to downgrade the error to a warning.
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install GemName
Personally I have got this problem while installing json gem , I did :
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install json
And the problem was solved.
Not sure what happened but when I upgraded to Mavericks it says that Rails it not install. I executed the following command:
rails --version
And it said "Rails is not currently installed and run sudo gem install rails".
I run sudo gem install rails and get the following:
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/json-1.8.1 for inspection.
UPDATE:
I ran the command gcc --version and got the following:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
You need to install the Command Line Developer Tools. Just open Terminal and type up a command that requires it -- for instance, git, gcc or make. Or use the following command:
$ xcode-select --install
You'll see an alert like this:
Just click Install and that's it. As of OS X 10.9, there's no longer need to install Xcode for Ruby development.
Credit for the steps and picture goes to Daniel Kehoe in his latest guide: http://railsapps.github.io/installrubyonrails-mac.html
I had the same problem which I have now been able to solve.
The problem for me was that I had updated to the latest version of Xcode through the appstore but hadn't actually opened the application to complete the install. So here's what solved it for me:
Updated Xcode
Opened Xcode application
Accepted license agreement
Installed rails
Hope it works for you too.
It wasn't working for me even when I reinstalled xcode and the command line tools for mavericks.
But after that, I just did a bundle update and, for some reason, it worked.
I think I had the same issues. I updated the xcode and open xcode to accept licence aggrement. Then it worked fine as far as I can remember.
I tried to install the new beta on my system with the command:
sudo gem install rails --pre
but no matter what I tried, I still get this damn error:
Successfully installed
rails-3.0.0.beta3 1 gem
installed Installing ri
documentation for
rails-3.0.0.beta3... File not
found: lib
Since I'm very new to ruby, I really don't know what to do.
How can I finish installing this?
Is this installed already?
Why does it abort here?
All you need to run is gem install rdoc, follow its instructions, then run the install rails command again and you're good. The problem is due to rdoc failing to install when installed with rails, if installed manually it works fine.
Source: http://gist.github.com/565967
^ I had the same problem, and this worked for me.
If you're looking to do ruby/rails development on Mac, I'd strongly recommend not using the version of ruby/rubygems shipped with your mac. What I do recommend is:
Installing homebrew and using that to manage software packages on your mac.
Install brewbygems, which makes homebrew play nice with rubygems: gem install brewbygems
Install rvm and learn to love the different versions of ruby and rvm's gemsets feature: gem install rvm
Once you've done that you'll have a pretty robust development environment and you should be able to install any version of rails without a problem. Just keep in mind rails 3 works best using ruby 1.9.2 (install with rvm by running rvm install ruby-head) and is still in beta, meaning it isn't terribly stable and should not be used for anything production grade (yet).
I found the same error message, while after some google I've successfully installed it by manually 'sudo mkdir lib' in the .../gems/rails-3.0.0.beta3. Though it hasn't raised further problem, I hope someone could tell what should be in the missing lib directory.
You don't really need to do this sudo gem install rails --pre, simply sudo gem install rails. Rails3 is the default package now and out of beta.
It should work fine.
Might be a different solution on your OS, but I got the same exact error in Ubuntu and creating a ¨lib¨ folder under the rails gem folder solved my problem. I have explained the solution in the following post:
Installing Rails: "File not found: lib"
For convenience I will copy it here as well. The solution:
mkdir /lib/ruby/gems/1.8/gems/rails-{whatever your version is}/lib
Explanation: The ¨[sudo] gem install rails¨ command expects the /lib folder (at the end) but for some reason it hasn´t been created yet.
The original source of this solution was the following URL. Hope it helps!
http://www.spritle.com/blogs/?p=915
Same problem with beta 4.
The workaround is sudo gem install rails --pre --no-ri --no-rdoc though I don't know why.