Using RubyGems on ubuntu server - ruby

I have installed Ruby on Rails on my Ubuntu 10.04 Server by official tutorial: https://help.ubuntu.com/10.04/serverguide/C/ruby-on-rails.html
But I have some troubles with it. Please, help me!
1) I can't install ANY gem!
sudo gem install sqlite3-ruby
returns
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native
extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:3:in `require': no such
file to load -- mkmf (LoadError) from
extconf.rb:3
Gem files will remain installed in
/var/lib/gems/1.8/gems/sqlite3-1.3.3
for inspection. Results logged to
/var/lib/gems/1.8/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out
2) When i'am trying to get Rails version by command
rails -v
Server prints:
getopt: invalid option -- 'v'
Terminating...

If you are not set on using the packages in the Ubuntu repos(and I see no reason why you'd be), I'd suggest following this guide:
http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you

Consider going through and making sure your sqlite3 libraries are installed. It looks as though you may be missing the required dependencies to build your gem. In this case you might try running this before installing your gem:
sudo apt-get install libsqlite3-dev
Also, try
rails --version
instead.

Related

Unable to Install Shoes :ruby

I am beginner in ruby and wanted to install and GUI toolkit. So i surfed web and found shoes was one toolkit so i downloaded the ".install" file it didn't work saying some permission error, then i downloaded the older version which was ".run" format and that too didn't work so i found a gem of shoes when i try to download i get the below in ruby. i downloaded this shoes from git and still facing some error.
root#Drona:/home/naren/shoes4# gem install bundler && bundle install
Successfully installed bundler-1.10.5
1 gem installed
Installing ri documentation for bundler-1.10.5...
Installing RDoc documentation for bundler-1.10.5...
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all
non-root users on this machine.
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies....
Using rake 10.4.2
Using addressable 2.3.8
Using after_do 0.3.1
Using ast 2.0.0
Using parser 2.2.2.6
Using astrolabe 1.3.0
Using benchmark-ips 2.2.0
Using bouncy-castle-java 1.5.0147
Using docile 1.1.5
Installing json 1.8.3 with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.8.3 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.8.3/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.3'` succeeds before bundling.
the above is the terminal output.
Ruby version installed is :
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
someone help we out with this installation
and if i have done anything wrong in installation of shoes then let me know
From your terminal directory it seems like you are trying to install shoes4 on ruby 1.9.3. To install shoes4 you need JRuby and a JDK - please follow the instructions in the readme
Shoes 3 can't be installed through gem install due to the way it was built. For Shoes 3 you need the install script, I recommend the appropriate Shoes 3.2 version from this page. If this fails with some error please let us know the error so we can help :)
You should use the gem program to install shoes. If on your command line you type gem install shoes you should be fine.
to use it in an app, you would need to create a Gemfile and run Bundle install within your folder

ERROR: Error installing json: ERROR: Failed to build gem native extension

I am trying to install gem json and getting error for json.
I'm running:
Windows 8.1 (64 bit)
Ruby: ruby 1.9.3p545 (2014-02-24) [i386-mingw32]
gem: 1.8.2
D:\GIT\calabash>gem install json -v '1.8.3'
Building native extensions. This could take a while...
The system cannot find the path specified.
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.3 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.3/ext/json/ext/generator/gem_make.out
D:\GIT\calabash>
Its a late response, but may it helps someone else. to install json '1.8.3' it requires packages 'libgmp3-dev'.
Use following steps:
sudo apt-get install libgmp3-dev
gem install json -v '1.8.3'
For anyone who has this issue on Sierra, I solved the problem through this thread: https://teamtreehouse.com/community/installing-ruby-on-mac-got-error
Coles notes version is that after updating to most recent version of XCode, I had to accept the terms for the XCode command line tools. See them/agree to them by running:
gcc --version
After I did that, everything installed as expected.
To help you here are some steps to follow in order to install your gem locally:
Download json-1.8.3.
Place the downloaded gem into a folder called gems
Open the Ruby cmd console (click on start button, select Ruby then select "Start command prompt with Ruby")
cd to the gems folder. If the path to the folder is C:\Desktop\gems, write the command: cd C:\Desktop\gems then click "Enter".
To install the gem run the following command:
gem install --local json-1.8.3.gem
I tried it and it worked for me, hopefully it will work for you.
Result:
Second way:
Include the whole path of the gem in the command:
gem install --local C:\Users\kedarl\Desktop\T\json-1.8.2.gem
For me here is the result. (This time with the json-1.8.2.gem):
I've solved this by installing Command Line Tools Xcode of the version I have. I hope this helps someone else.
If you installed Rails through RailsInstaller, try this -
https://gist.github.com/luislavena/f064211759ee0f806c88
It's a pretty common bug for RailsInstaller currently.

Ruby: install mysql2

Windows 7 32bits
Hi everyone, how can I install mysql2 properly in windows 7 I have this error:
c:\dev\mysql2>gem install mysql2-0.3.13.gem --no-ri --no-rdoc -- --with-mysql-di r=c:\mysql-connector-c-noinstall-6.0.2-win32
This could take a while...
ERROR: Error installing mysql2-0.3.13.gem:
ERROR: Failed to build gem native extension.
C:/Ruby200/bin/ruby.exe extconf.rb --with-mysql-dir=c:\mysql-connector-c-noi
nstall-6.0.2-win32
Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.
3.13 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.13/ext/mysql2/g
em_make.out
c:\dev\mysql2>
Try to install using different version, It's happens because sometime binary is not available for specific verion for window.
gem install mysql2 -v 0.2.6
If still you have issues, Try below steps.
1) Download the MySql C Connector from: http://dev.mysql.com/downloads/connector/c/
NOTE Don't download the installer, download the ARCHIVE for your OS
2) Extract the file to C:\mysql-connector
3) Then ran:
gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\mysql-connector\lib" --with-mysql-include="C:\mysql-connector\include" --with-mysql-dir="C:\mysql-connector"'
It's works for me.

Error while installing watir-webdriver on Ubuntu 11.10

After going step by step (installed both ruby and rubygems properly) to install watir-webdriver, I am facing following error:
ERROR: Error installing watir-webdriver:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- mkmf (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from extconf.rb:4:in `<main>'
Please help me resolve this and do let me know what made this happened?
Not sure how you are installing ruby on your Ubuntu machine but may I recommend the Ruby Version Manager.
https://rvm.io/
this will allow you to install different versions of ruby on your machine and switch between them as well as gems etc.
here is a quick guide I wrote for installing watir webdriver in Ubuntu via RVM:
Ubuntu requires the use of a Ruby Version Manager. To do this we will need to first install both the Curl package and Git-core.
To do this use the following command:
sudo apt-get install curl git-core
Upon success we will need to download the Ruby Version Manager application. This application allows us to install multiple versions of ruby as well as switch between. It also provides a Gem manger. Recommended to Google to read up on the commands and features within RVM. To install RVM use the following:
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
We can also install packages within RVM and we will require the use of openSSL:
rvm pkg install openssl
Then installing Ruby itself:
rvm install 1.9.3-p125 --with-openssl-dir=$rvm_path/usr
Best to test this is all working with:
irb
When all clear we can install the Gem, we need to install it within the RVM with the follow:
rvm do gem install watir-webdriver
If installed correctly we should be able to use watir to drive firefox which is already installed on ubuntu.
I am not Linux/Ubuntu expert but the error message says you do not have build tools installed.

error while installing fastthread from ruby gem . How to remove the error?

gem install fastthread -v1.0.7
Building native extensions. This could take a while...
ERROR: Error installing fastthread:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:8:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:8
Gem files will remain installed in /var/lib/gems/1.8/gems/fastthread-1.0.7 for inspection.
Results logged to /var/lib/gems/1.8/gems/fastthread-1.0.7/ext/fastthread/gem_make.out
This is what I got when I tried installing from fastthread to set up SUP mail client on my system . How to get rid of this error?
Install these and then try re-installing:
sudo apt-get install ruby1.8-dev
Try this link http://kenno.wordpress.com/2009/07/25/fixed-extconf-rb8in-require-no-such-file-to-load-mkmf-loaderror/
I was getting this same error in OS X Lion. Having Xcode 4.3 installed doesn't cut it. You have to go to preferences in Xcode and install the command line tools, which installs the necessary compiler tools for doing native builds on the system. After I did this, then gem install fastthread worked for me.
Just to add to this, on debian and ubuntu the "complete" ruby package is this:
ruby1.8 ruby1.8-dev ri1.8 rdoc1.8 irb1.8 ruby1.8-elisp
ruby1.8-examples libdbm-ruby1.8 libgdbm-ruby1.8 libtcltk-ruby1.8
libopenssl-ruby1.8 libreadline-ruby1.8
So something like
sudo aptitude install ruby1.8 ruby1.8-dev ri1.8 rdoc1.8 irb1.8 ruby1.8-elisp ruby1.8-examples libdbm-ruby1.8 libgdbm-ruby1.8 libtcltk-ruby1.8 libopenssl-ruby1.8 libreadline-ruby1.8
Will save you a lot of time when doing bundle install on a large project.

Resources