I'm stuck trying to install rails on my mac. I have OS X 10.6.8 and I have confirmed that I have Ruby, version 1.8.7
I ran sudo gem update and sudo gem update --system to get the latest versions of the software.
However, when I run sudo gem install rails I get this error:
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.3 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.6.3/ext/json/ext/parser/gem_make.out
If you have XCode 4 or later you will need to open it and go to Preferences -> Downloads -> Components and install the Command Line tools as they aren't installed by default. Couldn't install Rails until this happened.
Im using osx 10.10. You can download from the command-line
xcode-select --install
Not sure what it needs to compile, but OSX can't compile any native ruby extensions at all unless the Apple developer tools are installed. On 10.7 Lion you can download it free from the app store, or Download it here for 10.6: http://developer.apple.com/xcode/index.php
It may also be on your OSX install discs, though probably much more out of date.
Did you install the OS X developer tools? You'll need to do this to be able to build native extensions
Just a follow up ...
it may be that you are on a mac and rails cannot find the right compiler for c headers.
just install xcode from apps store / homebrew or go to terminal ...
$ xcode-select --install
complete the installation and agree on the licensing etc, then ...
$ sudo gem install rails
There are two possible reasons for the fail:
PRIMARY REASON: Missing Xcode Command Line Tools
Verifying Xcode Command Line Tools Installation manually:
Check for presence of
"/usr/include/iconv.h" (if absent=>Missing or improperly installed Xcode CLT)
Installing Xcode CLT:
Try running xcode-select --install on terminal and follow the instructions. If it fails, open Xcode.app, select from menu "Xcode" - "Open Developer Tool" - "More Developer Tools" to open the developer site, download the installer for your OS version and run it.
SECONDARY REASON(if 1. fails): Version issues
Try upgrading the ruby version using rbenv.
Hope it helps!
Steps to sort out this issue:
Follow these steps unless error is fixed.
Open terminal and run commands:
sudo xcode-select --install
sudo xcodebuild -license accept
Make sure you have installed only one Xcode and it is the latest one. If more than one version is installed then keep only the latest one with name in applications like Xcode.app
Open Xcode->preferences->locations then check if any command line tools are selected; if not then select
Install Ruby by:
brew install ruby
Install CocoaPods by
sudo gem install cocoapods
Try to install Ruby via RVM. I solved in this way
How to install ruby on Ubuntu with rvm
The Command line tools didn't solve this issue for me.
I upgraded ruby installation through rbenv to 2.2.0, made that the global default ruby installation, and this issue was fixed.
Switch Ruby to Homebrew version:
$ brew install ruby
$ brew link --overwrite ruby
$ echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
$ echo 'export LDFLAGS="-L/usr/local/opt/ruby/lib"' >> ~/.bash_profile
$ echo 'export CPPFLAGS="-I/usr/local/opt/ruby/include"' >> ~/.bash_profile
Just had a similar issue. I can confirm that installing the command line tools fixes it.
https://stackoverflow.com/a/58226876/8070378
Solved after run:
sudo xcode-select --install
sudo xcodebuild -license accept
I had this problem on macOS Catalina 10.15.7, and it seems that Xcode 12.3's Ruby is a variant of 2.6, but my software needed 2.7.
I installed rvm and ran rvm install ruby-2.7, and now it works just fine 🎉
Related
As per the steps given in fastlane docs, I am not able to install fastlane.
After running brew cask install fastlane, I get this pop up:
If I try to run from gem with sudo gem install fastlane, I get this error:
What I see is the ruby.h file is missing from the directory. As it says in the error, I need to install the ruby-dev environment separately. But I could not find how to do that. I saw apt-get commands for this, but then what about the ruby installed via brew?
ruby -v: ruby 2.6.3p62
brew -v: Homebrew 2.1.10
brew upgrade ruby: ruby 2.6.3 already installed
Since the error says we have to instal ruby as a separate package for development, I had to install rbenv as shown on ROR's website. You can check the full problem and solution here.
Run this to disable Gatekeeper:
sudo spctl --master-disable
Then install and run fastlane. When done, run this to re-enable Gatekeeper:
sudo spctl --master-enable
It will remember that you have permitted the application after re-enabling Gatekeeper and you will not have to run these commands every time you use it.
According to https://github.com/fastlane/fastlane/issues/15183
This is a common issue which nobody can solve it.
In case you can't update fastlane version
try
sudo gem install -n /usr/local/bin fastlane
I'm having some trouble installing jekyll. Can't quite figure out how to patch the missing link. I think it's an update to Ruby, but RVM is having trouble installing alternate versions of ruby as well.
Heres the full post:
$ sudo gem install jekyll
ERROR: Error installing jekyll:
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/fast-stemmer-1.0.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/fast-stemmer-1.0.1/ext/gem_make.out
Does this mean I need to update the version of ruby I'm using via rvm?
Ubuntu
sudo apt-get install ruby-dev
gem install jekyll
Your problem is that either you system doesn't know where make is located at or you don't have it installed. The easiest way to fix this (and probably other issues you'll run into trying to get a ruby system up and running) is to install xcode.
You can get it at http://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12 for lion. Or it came on a CD with your computer for earlier versions.
If you're using Lion, please see comments below for a link to how to install developer tools on Lion.
I had the same error on Ubuntu and this helped me sort it out.
You must have ruby-dev installed
apt-get install ruby-dev
If you installed XCode and command line tools are still missing go to Terminal and
xcode-select --install
it will prompt you to install these tools. After that just follow SrBlanco´s answer. That solved the problem for me.
Good luck.
Need to install "make".
I am using Ubuntu 12.10.
sudo apt-get install make
Should work on any Debian based distro.
Note: this problem also occurs on newer MacBook Pro models that come with Mavericks pre-installed. I updated another post with my own solution that didn't involve Xcode at all. My system had the Xcode developer tools installed when I got the machine.
ERROR: Error installing jekyll: ERROR: Failed to build gem native extension
Install Xcode as mentioned if you don't have it installed already (https://developer.apple.com/xcode/). Plus you need the command line tools.
Open Xcode. Go to Preferences > Downloads > Install Command Line Tools
Installing command line tools for Xcode solved the problem for me on my Mac
xcode-select --install.
sudo apt-get install ruby-dev
sudo gem install jekyll
hope this will help, it works with me.
I had this same exact error when trying to install Jekyll, and the following steps from this link helped me. Just in case anyone else comes across this!
http://davidensinger.com/2013/03/installing-jekyll/
I was facing the same issue in my Fedora 22 setup. I had ruby installed but didn't have ruby-devel. Installing ruby-devel fixed the issue for me.
dnf install -y ruby-devel
For older systems:
yum install -y ruby-devel
I followed this on Ubuntu/Linux Mint
sudo apt install build-essential
sudo apt install ruby-dev
sudo gem install jekyll
An addendum: You can install XCode now from the App Store on Mountain Lion. The process is transparent and pretty fast.
I had the same problems with you.
I use Mac OS X 10.9 develop preview version, and I had installed gcc and Xcode.
But my Xcode version is 4.6.
Then I install the Xcode 5.0
After that I type sudo gem install jekyll in the terminal again. Then it works.
Wish it could help someone.
Installing Xcode and going to perferencs > downloads > install commandline tools WORKS!
Same problem on Debian, I had forgot to run this command:
~/.rvm/scripts/rvm
All these answers did NOT work for me.
If you're looking for a solution on ubuntu 14.04, do this:
sudo apt-get install ruby1.9.1-dev zlib1g-dev nodejs
sudo gem install jekyll -v 2.5.3
Unfortunately, nodejs is required because of a bug in Jekyll that enforces existence of runtime JS engine even though it doesn't need one.
For Ubuntu, this helped in my case:
apt-get install libffi-dev
A general advice is to just follow what is displayed as the reason for the error and hopefully you'll be provided with a log file in which the first line suggests which package should be installed, in my case:
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/ffi-1.9.21/mkmf.log
MacOS
my solution to this problem
install xcode
type xcode-select --install in the command line
type sudo gem install jekyll in the command line
PS: It is the combination of the two answers in this question.
You are missing the ruby-dev file , just go ahead and run this command - sudo apt-get install ruby-dev
Hope this helps!!
I had the same issue on my macOS(10.14.2), the reason may be:
Apparently with OSX el Capitan, there is a new security function that prevents you from modifying system files called Rootless.
My solution is using rvm:
install ruby on Mac OS X with RVM
gem install jekyll
On windows I have this issue
I actually installed the version rubyinstaller-devkit-2.6.3-1-x64 of ruby
I have removed the ruby completely and Installed the rubyinstaller-devkit-2.5.5-1-x64
and issued the following commands on powershell
gem install bundler
gem install jekyll
and this time no errors where found
I had this issue and of all things, the error was occurring because I hadn't agreed to some updated terms of service in xcode. Running the following did the trick for me. Go figure.
sudo xcodebuild -license accept
For me, I had to upgrade homebrew and install rbenv to the latest ruby version. After that, I followed the instruction at jekyll website. My OS is Catalina 2019, I couldn't install Xcode, which is not compatible yet!
You have to set the path in your .bash_profile to make sure that it initializes the rbenv when you restart your terminal.
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
then
$ rbenv version
2.2.3 (set by /Users/mislav/.rbenv/version)
$ rbenv shell
rbenv: no shell-specific version configured
hope that help!
Here is the (only?) reliable and simple way to install Jekyll on macOS
Install UTM
Install Ubuntu Server
Install Jekyll using Ubuntu instructions at https://jekyllrb.com/docs/installation/ubuntu/
Forward port 22 in the VM settings (22->localhost->22)
Use VS Code on the macOS host
Install Remote SSH
Connect to USER#localhost
Drag and drop the folder on Mac into VS Code (this transfers files to remote)
Enable port forwarding for 4000 (bottom bar on VS Code)
Work on your website
Right click on your website on the file explorer and click download
If you have not done these steps, you might be delighted by:
Ubuntu imports your public SSH key from GitHub
VS Code magically handles file transfer in and out
VS Code magically installs your VS Code extensions onto the remote server and allows file search on the remote host
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 get this error when I try to install Rails on my Mac OS Lion. I used the command -
$ sudo gem install rails
/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
Any steps I need to follow to install rails?
Thanks
Just avoid using the bundled ruby, which is 1.8 and it is really outdated. Install rvm which will provide an up-to-date ruby version and then everything will work seamlessly. This is the only thing you need to start:
$ curl -L https://get.rvm.io | bash -s stable --rails
You will need the gcc/g++ toolchain (Xcode) to build everything but you would have needed it in anycase to compile any native gem.
It looks like you're missing some header files - try reinstalling XCode and the developer tools. If you already downloaded XCode, make sure you've run the installer that it put into /Applications for you.
Like Jack says, using rvm will be a lot smoother.
The system Ruby in Mac OS is outdated, I recommend to you install RVM or Rbenv to manage your installed Rubies or to install new versions.
I used to have no problems at all with ruby, gems and all related stuff. But after installing X Code Developer Tools and upgrading to Lion the gems do not install.
I get the following error for every gem. This is the message for sqlite as an example:
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
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-1.3.4 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.4/ext/sqlite3/gem_make.out
What went wrong? How to fix it?
I had to install the Command Line Tools in the latest Xcode-Version (4.3.1) and
sudo gem install rails
worked like a charm.
To install Command Line Tools, go to Xcode Preferences > Downloads or use the following command in terminal (thx #Purell):
xcode-select --install
I'm using Mavericks and Ruby 2.0.0 and I also got this error (mkmf.rb can't find header files) when installing gems. I solved this issue by creating some symbolic links in Terminal.
#First install developer tools again:
xcode-select --install
#Create symbolic link to Ruby include (updated for 10.9)
sudo ln -s /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include
#Create symbolic link to config.h (updated for 10.9)
sudo ln -s /System/Library/Frameworks/Ruby.framework/Versions/2.0/Headers/ruby/config.h /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/config.h
I faced same problem while trying to install rails on my Lion. This is how i could solve it.
Install rvm
$ curl https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable
Install osx-gcc-installer
https://github.com/kennethreitz/osx-gcc-installer
Installed new version of ruby
rvm install 1.9.3
Typed to following command to show the requirements
rvm requirements
To use an RVM installed Ruby as default, instead of the system ruby:
rvm system ; rvm gemset export system.gems ; rvm 1.9.3 ; rvm gemset import system.gems # migrate your gems
rvm alias create default 1.9.3
Installed rails:
sudo gem install rails
My Mac is now read for rails!! YAY!!
Not a direct solution to your problem, but I'd suggest using rvm to install fresh rubies and gems. That should take care of it.
While installing Rails I had the error :
can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
As i had already Xcode installed, I had just to install Command Line Tools to resolve this problem
You need to have XCode installed, it includes ruby.h as well as some other important files needed to compile other native gems.
Hello i'm sorry i can't test this answer but i would suggest to change the default search paths in your bashrc and extconf.rb since the Library files seem to be moved in Lion.
(P.S. if he wants to work with the default 1.8 Version, rvm would be an unneeded hassle)
Update to the latest version of xcode, that fixed the problem for me. Make sure xcodebuild is in your path.
running xcodebuild -version in a terminal window should output 4.2.1 (4.x at least).
After a OS-Update make sure that you do accept the X-Code license even when you have used command-line-tools before. Only then some header-files will be available. To accept the license you have to run X-Code once.
I just forgot to run it with the sudo command.
sudo gem install sqlite3
not:
gem install sqlite3