Related
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
When I used "sudo apt-get install ruby-full build-essential" in the terminal I got this:
$ sudo apt-get install ruby-full build-essential
Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/packages.medibuntu.org_dists_quantal_non-free_binary-i386_Packages
E: The package lists or status file could not be parsed or opened.
Can anybody tell me how can I install Ruby on Rails in my Linux Mint machine?
I think you don't need features of rvm. You just want to install ruby easy, fast and without troubles, right? Good news to you. We got an alternative to rvm. It's called rbenv. You can find an installation guide here.(don't skip ruby-build, it is necessary!).
And yes, follow ubuntu instructions since Mint is build on it (though there's debian-based version but I suppose you use ubuntu-based one).
I installed yesterday Mint 16 and rbenv on it. Works fine.
PS: don't forget to sudo apt-get install build-essential first.
I actually use Mint on my main development system. I'd also recommend using RVM to manage all your Ruby and Rails installation/versions. The command to install it is:
\curl -L https://get.rvm.io | bash -s stable
You can also append --ruby and --rails to get (I believe) the most recent versions of the two of them. I'd recommend not using apt-get for installing Ruby, as I've noticed that it can be out of date and/or lead to strange errors like those that you're seeing. You can get more information from the RVM website. I really enjoy using Mint, so I hope that helps.
Use rvm to install Ruby then simply install rails gem , but before that fix your repository related problem.
sudo rm -rf /var/log/apt/list
sudo apt-get update
sudo apt-get upgrade
Then install rvm see rvm.io for installation info
If you are new want to setup everything from start then see this blog post
https://www.computersnyou.com/4235
Use rbenv
instead, use this link DigitalOcean since mint is an ubuntu based distro, it will work.
I have been developing rails applications on windows xp. I now need to deploy these apps to a different computer, which has Ubuntu 10.04.1 LTS. To install ruby and rails on my windows machine, I used the RailsInstaller. I now need to get ruby and rails working on my Ubuntu machine. It isn't connected to the internet so pretty much every tutorial I found hasn't worked. Can I just transfer my installed files from my windows machine? In my RailsInstaller directory on my windows machine, there is the following directories: DevKit, Git, Ruby1.9.3, and scripts. It also has unins000.exe and unins000.dat. Will it work to just transfer these files or is there some other way to get ruby on rails working on my Ubuntu machine?
Windows and Ubuntu are two different operating systems. Read about operating systems here
You cannot copy software files from one Operating system to another. You can only move code and documents (images, music etc).
Anyway, since you are using Ubuntu, the tool that allows you to install software is called 'aptitude'. You will install software 'packages' from the terminal. It is similar to the command prompt in windows. You can open it by searching in the dash.
The command to install software is apt-get install package-name. You need to give it root privileges so you will have to prefix the command with sudo.
By default aptitude will fetch package from online repositories. But you can also make it install from a local file.
Another way for offline installation is to get the '.deb' package file of the software and run dpkg -i filename.deb.
Okay. So the idea is to download the software packages needed for ubuntu and use the installation tools provided to install them.
Ok For Ruby we have something called Ruby Version Manager or RVM. It allows you to have multiple versions of Ruby on your computer. I think that wont be necessary for you. But still we will go with RVM because of its ability to let you install ruby offline with ease.
Read more here: http://rvm.io/rvm/offline
As you might know, Rails is a gem of Ruby. In the above link you will find how to install Gems offline. Just download the Rails gem and install it using the local option of bundler. Ok I might have confused you with this paragraph. But you read the RVM documentation and you will understand.
If you do get an internet connection, there is an awesome tutorial (step by step) at DigitalOcean.com to guide you.
https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm
I know its for Ubuntu 12.04. But you wouldnt face much problem.
Good luck. And learn about operating systems.
Installation of Ruby on Rails for Production server is pretty straight forward. Below are the relevant steps.
1.INSTALL THE NEEDED LIBRARIES
sudo apt-get install zlib1g zlib1g-dev build-essential openssl libssl-dev libmysqlclient18 libmysqlclient-dev libyaml-dev
2.DOWNLOAD AND INSTALL RUBY 1.9.3
sudo apt-get update
sudo apt-get install ruby1.9.3
Note you can install latest Ruby too.
3.INSTALL RAILS
sudo apt-get install ruby-dev
sudo apt-get install build-essential g++
sudo gem install railsconfigure rails application with nginx and unicorn
4.INSTALL SQLITE ADAPTER
sudo apt-get install libsqlite3-dev
If you passed all above steps without any ERROR, Now it's time to create a rails demo application OR SCP existing one and test it out.
Below is the steps to create new rails application
rails new demo
cd demo
uncomment therubyracer gem in Gemfile
sudo apt-get install build-essential g++
bundle install
rails g scaffold order name:string
rake db:create
rake db:migrate
Open config/routes file and uncomment root 'welcome/index' and replaced with 'orders/index'
$rm -rf public/index
That's all, Now run your Rails application.
Checkout http://railscasts.com/episodes/335-deploying-to-a-vps and search for "capistrano" to deploy. It's an art.
"It isn't connected to the internet so pretty much every tutorial I found hasn't worked"
You are way off the beaten path here. but if you can get your git repo to a machine that is connected to the internet, you can deploy to Heroku easy, and/or run capistrano from there.
I was trying to install rails on Ubuntu Natty Narwhal 11.04, using ruby1.9.1.
I installed ruby using apt-get install ruby1.9.1-full which contains the dev package. I googled the error and all have suggested I install the 1.9.1-dev which I already have.
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
extconf.rb:36:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:36
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/bcrypt-ruby-3.0.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out
After some search for a solution it turns out the -dev package is needed, not just ruby1.8. So if you have ruby1.9.1 doing
sudo apt-get install ruby1.9.1-dev
or to install generic ruby version, use (as per #lamplightdev comment):
sudo apt-get install ruby-dev
should fix it.
Try locate mkmf to see if the file is actually there.
This is the answer that worked for me. Was in the comments above, but deserves its rightful place as answer for ubuntu 12.04 ruby 1.8.7
sudo apt-get install ruby-dev
# if above doesnt work make sure you have build essential
sudo apt-get install build-essential
I also needed build-essential installed:
sudo apt-get install build-essential
The problem is still is recursive on Ubuntu 13/04/13.10/14.04
and
sudo apt-get install ruby1.9.1-dev
worked out for me okay. So If you are using Ubuntu 13.04/13.10/14.04 then using this will really come in handy.
This works even if ruby version is 1.9.3. This is because there is no ruby1.9.3-dev available in the Repository...
Have you tried:
sudo apt-get install ruby1.8-dev
I got the similar error when install bundle
sudo apt-get install ruby-dev
Works great for me and solve the problem
Mint 16 ruby1.9.3
I think is a little late but
sudo yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel
worked for me on fedora.
http://nokogiri.org/tutorials/installing_nokogiri.html
You've Ruby 1.8 so you need to upgrade to at least 1.9 to make it working.
If so, then check How to install a specific version of a ruby gem?
If this won't help, then reinstalling ruby-dev again.
You can use RVM(Ruby version manager) which helps in managing all versions of ruby on your machine , which is very helpful for you development (when migrating to unstable release to stable release )
or for Linux (ubuntu) go for
sudo apt-get install ruby1.8-dev
then sudo gem install rails to verify it do rails -v it will show version on rails
after that you can install bundles (required gems for development)
Ruby version: 2.7.1
gem version: 3.1.3
You need to check the extension that could not be installed, and find the reasons.
Read the mkmf.log file showed at the installation error under "To see why this extension failed to compile, please check the mkmf.log which can be found here" , perhaps there is a missing lib ( sometimes iconv ), and you must install it.
You can search the extension with your package manager(apt, yum, pacman...) too.
(Personal case) Arch Linux->nokogiri
gem install rails
Showed me:
To see why this extension failed to compile, please check the mkmf.log
which can be found here:
/home/user/.gem/ruby/2.7.0/extensions/x86_64-linux/2.7.0/nokogiri-1.10.9/mkmf.log
Go to: https://aur.archlinux.org/packages/ruby-nokogiri/
Make sure you have all dependencies installed
Make sure you have make installed
git clone the package
cd to package
makepkg the package
Hope to help!
I am new to Ruby and just diving in. The Ruby tutorial says I should get the packaging system from here: http://rubyforge.org/frs/?group_id=126
I am on Ubuntu Linux. The page has a .tar and a .gem option for downloading. Which should I download?
Also, are gems exactly analogous to Java jars? And why do I need the gem packaging system if I can just download gems one by one as they are needed?
Ubuntu now have rubygems as a package
For Ubuntu 12:
sudo apt-get install rubygems
For Ubuntu 14.04:
sudo apt-get install rubygems-integration
On Ubuntu 16.04 and Ubuntu 18.04, both sudo apt-get install rubygems and sudo apt-get install rubygems-integration failed for me. Instead, I had to do this:
sudo apt-get install ruby-dev
If on Ubuntu 14.04 try below
sudo apt-get install rubygems-integration
First, download *.tar file, unpack this file, then go to rubygems directory in your console, and type
ruby setup.rb
That's it :)
If you install the full ruby application set with
sudo apt-get install ruby-full
You will get gems and much more by default. Tested on Ubuntu 16, it could also work on other version.
For me in Ubuntu 20.04 I did 3 things to create a new Ruby and Rails app.
Install Ruby development version
sudo apt install ruby-dev
Install rails from gem
sudo gem install rails
Create new application
rails new blog
I got error while installing rails(sudo apt install rails) only, So I installed devlopment version. I got permission related error while not using Sudo as well while installing gems and rails.
For Ubuntu
First install ruby:
sudo apt install ruby
Note that : sudo snap install ruby will throw this error :
error: This revision of snap "ruby" was published using classic
confinement and
thus may perform arbitrary system changes outside of the security
sandbox that snaps are usually confined to, which may put your system at
risk.
If you understand and want to proceed repeat the command including
--classic.
Finally, download latest tar version of ruby gems here:
https://rubygems.org/pages/download
Unzip and cd to the folder and finally type in terminal:
sudo ruby setup.rb