I downloaded ruby on rails on ubuntu 12.10 through this tutorial http://technical-feeds.blogspot.ca/2013/02/how-to-install-ubuntu-and-ruby-on-rails.html.
I did everything and it worked fine.
I checked ruby -v and it came back as ruby 2.0.0p0. I also checked rails, rubygems and git they came back good.
Then I closed the terminal and opened a new one and tried to check the version but this came back for ruby:
bimbola#ubuntu:~$ ruby -v
The program 'ruby' can be found in the following packages:
* ruby1.8
* ruby1.9.1
Try: sudo apt-get install <selected package>
And this came for rails:
bimbola#ubuntu:~$ rails -v
The program 'rails' can be found in the following packages:
* rails
* ruby-railties-3.2
Try: sudo apt-get install <selected package>
git is still fine though
bimbola#ubuntu:~$ git --version
git version 1.7.10.4
You need to state which version of ruby you want to use. Try this:
rvm use 2.0.0
You can also set a particular version of ruby to be used as default as shown below
rvm --default use 2.0.0
RVM (Ruby Version Manager) allows you to install multiple versions of ruby and use any one of them at a time as according to your whim.
To see all the available ruby versions on your system try this:
rvm list
Add a line to your bashrc to load rvm automatically: (execute in Terminal)
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> .bashrc
or load rvm manually:
source "$HOME/.rvm/scripts/rvm"
Related
I have installed Ruby via RVM on Windows Insider Build(Ubuntu Bash). RVM installed successfully and so did ruby.
I have also installed bundler with "gem install bundler". Updated few gems and stuff. But now it says on ruby -v
cooldudeabhi#ACERASPIRE:~$ ruby -v
The program 'ruby' can be found in the following packages:
* ruby
* ruby1.8
Try: sudo apt-get install <selected package>
cooldudeabhi#ACERASPIRE:~$ gem
The program 'gem' can be found in the following packages:
* ruby
* rubygems
Try: sudo apt-get install <selected package>
cooldudeabhi#ACERASPIRE:~$
I suspect its a PATH problem but I am not sure if it really is? If its a PATH problem I don't know what to set in bashrc files please tell that. Thanks
I have found similar question on stackoverflow but it doesn't help in case of Windows.
Also /usr/local/bin is empty that's strange
Add this line to your profile settings (.bashrc or .bash_profile)
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
answer referred from here
I installed ruby and rails and other gems in ubuntu via terminal using rvm
After installation i checked the version of ruby and rails.
Later i closed the terminal. now I am not able to find ruby in it.
I am new to ruby and ubuntu as well. I am sure its installed . But after closing the terminal when I open it again and type "ruby -v"
I get this :
ubuntu#ubuntu:~$ ruby -v
The program 'ruby' can be found in the following packages:
* ruby
* ruby1.8 (You will have to enable component called 'universe')
Try: sudo apt-get install <selected package>
ubuntu#ubuntu:~$
I would highly suggest using rbenv instead of rvm for Ruby these days.
A guide on how to install it is located here: https://gorails.com/setup/ubuntu/14.10
The Ruby will then be installed in the .rbenv directory that is located in your $HOME folder.
To answer your question on where rvm installs it, it is installed into .rvm folder in your $HOME
My configurations
Ubuntu 14.04 amd64
I followed this tutorial to install Ruby
Successfully installed ruby.
Closed the Terminal.
Checking
ruby -v
shows
The program 'ruby' can be found in the following packages:
* ruby
* ruby1.8
Try: sudo apt-get install <selected package>
4.Runs the command
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
from the tutorial and then check with ruby -v and it works !!( Shows the version )
5.I tried a many times by closing the terminal and typing ruby -v command every time it shows ruby is not installed and typed the same command from the tutorial then it detect the ruby.
How can avoid this ?
The instructions on making rvm work in gnome-terminal can be found here, quoting the instructions:
For RVM to work properly, you have to set the 'Run command as login
shell' checkbox on the Title and Command tab inside of
gnome-terminal's Settings page
I have had rails installed and almost working. Was working on a solution to another problem with I accidentally closed the bash window. So I reopened it, and now I am unable to use rails at all and it's telling me that rails isn't installed. So I ran gem install rails --no-ri --no-rdocand now I get the following:
ERROR: While executing gem ... (Errno::EEXIST)
File exists # dir_s_mkdir - /usr/local/Cellar/ruby/2.1.1_1/lib/ruby/gems`
How do I correct this error?
I just removed the broken gems, site_ruby and vendor_ruby symlinks from the /usr/local/Cellar/ruby/2.1.1_1/lib/ruby/ folder and now everything seems to work fine.
I just added a gems/ directory here /usr/local/lib/ruby/ and that solved the issue.
for a temporary solution, you can mkdir -p /usr/local/Cellar/ruby/2.1.1_1/lib/ruby/gems/2.1.0 to solve.
When you open your bash window (called the "terminal window" or "console"), what folder ("directory") are you in? Find out with:
$ pwd
Navigate to the folder where you created your Rails project using the Unix cd command, for example:
$ cd workspace/learn-rails
If you are using RVM, make sure you have selected the correct gemset:
$ rvm gemset list
gemsets for ruby-2.1.1 (found in ...)
(default)
global
=> learn-rails
Then see if Ruby and Rails are installed:
$ ruby -v
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]
$ rails -v
Rails 4.1.0
Refer to the article Install Ruby on Rails for help. If you haven't followed all the steps in the article, you may have problems, especially if you followed some of the inaccurate instructions found elsewhere on the web.
I was recently in this wormhole. It seems like Homebrew's ruby installation has an issue with soft links and uses version 2.1.1. I couldn't "gem install" anything without getting the annoying "File exists # dir_s_mkdir" error. Even tried MacPort and that was a nightmare.
First uninstall ruby via
brew uninstall ruby
or
port uninstall ruby
And follow the instruction on https://rvm.io/rvm/install to install ruby
\curl -sSL https://get.rvm.io | bash -s stable --ruby
It might then complain about ruby-2.0.0-p353 not installed
To install do:
rvm install ruby-2.0.0-p353
Then run the rvm install script. Your "gem install << whatever >>" should now work
This fixed the issue for me (Homebrew on a Mac, Ruby 2.1.3):
$ brew reinstall ruby
$ brew unlink ruby && brew link ruby
the same issue. I just remove dir_s_mkdir, then pod install. it works for me!
is there any way to install Ruby 1.9.2 or 1.8.7 + Rails 3 on my debian squeeze?
You probably don't want to use RVM on a production machine. Its $PATH magic will break in non-obvious places (e.g. cron jobs), and you'll be up a creek.
You could simply build from sources and use checkinstall to create a .deb for yourself. Here's a tutorial for Ubuntu that should translate pretty well into debian.
First install rubygems, I think it's the only Debian package. Then (as Ruby gems):
rvm (install with it ruby 1.9.2, or Ruby version you want)
bundler
rails
And then you can manage application gems with Bundler.
Have you looked at railsready-debian-lenny (it is claimed to work on Squeeze too)? Don't forget to install dependencies pointed in readme.md
The steps below outlines installing Ruby On Rails as a normal user.
Check first if the user has sudo rights. To do this try executing a simple command
$sudo ls -a
[sudo] password for unlimit:
unlimit is not in the sudoers file. This incident will be reported.
If you see a message like above, you will need to add the user to the sudoer file, this can be done by
$echo 'unlimit ALL=(ALL) ALL' >> /etc/sudoers
Check if you have ruby installed. Execute the command below
$ruby -v
-[bash]: ruby:command not found
If you see something like this, this means ruby is not installed. Install it
$sudo apt-get install ruby
Install additional libraries
$sudo apt-get install build-essential
$sudo apt-get install curl
$sudo apt-get install libssl-dev
Install rvm
$curl -L get.rvm.io | bash -s stable
Set the rvm path
$source $HOME/.rvm/scripts/rvm
You should add this to the .bashrc file.
Fetch the latest rvm and reload it
$rvm get head && rvm reload
Install ruby 1.9.3
$rvm install 1.9.3 --with-openssl-dir=$HOME/.rvm.usr
I needed to install the readline lib
$sudo apt-get install libreadline-dev
Get the rails gem
$gem install rails -v 3.2.3
Check if you have rails
$rails -v
Rails 3.2.3
Get the readline package
$rvm pkg install readline
Get sqlite3
$sudo apt-get install sqlite3 libsqlite3-dev
You are all set to create your first rails app
$rails new app HelloWorld
You can find more info http://unlimit.in/installing-ruby-on-rails-on-debian.html
The best way to install Ruby and any Gems you like is with RVM. It will compile the latest version of Ruby for you and give you tools to manage gemsets.
Relying on the distribution's packages is usually a bad idea, because they are typically out-of-date.