I am using ubuntu 12.04 LTS.I have successfully installed ruby via rvm and rails.I can also see which version of rails and ruby in terminal by typing rails -v,ruby -v successively.On the other hand,I have installed terminator on my ubuntu and I have faced an error message while I was typing rails -v:
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
When I have typed ruby -v,no error message,it prints the version,no problem.
Please be noted that I have already installed ruby and rails successfully and it works correctly with terminal.
Here are some pictures of the situation:
http://imageshack.us/f/819/screenshotfrom201206281.png/
http://imageshack.us/photo/my-images/407/screenshotfrom201206281.png/
I had the same problem while using rvm.
To resolve it you should add:
source ~/.rvm/scripts/rvm
to your ~/.bashrc
I had a very similar problem. Many of the commands of my rails environment were not working on Terminator and the following solved it for me.
Right click on the Terminator window. Preferences > Profiles > Command and check "Run command as login shell"
Please refer to the following post as to why this works https://askubuntu.com/questions/121073/why-bash-profile-is-not-getting-sourced-when-opening-a-terminal
Here is some more insight on shell login from RVM https://rvm.io/support/faq#shell_login
I also enconter this problem like you , rails can run on terminal but not termilator, i can't resolve it. So I use tmux instead of termilator which also can splits windows and even more stronger.
Related
I recently started testing out the Ubuntu bash for Windows 10 sub-system for my Ruby and Rails work. To set up rails, I followed this guide from GoRails.com.
Everything worked yesterday. But after shutting down my PC and starting up the Ubuntu bash terminal again today, it doesn't seem to recognize ruby or rails anymore. i.e. typing ruby -v gives me this:
The program 'ruby' is currently not installed. You can install it by typing:
sudo apt install ruby
Typing rails -v gives me:
bash: /mnt/c/Ruby22-x64/bin/rails: ruby: bad interpreter: No such file or directory
For reference, I used the instructions from the above guide to install Ruby 2.4.0 using RVM and Rails 5.1.1. When I ran ruby -v and rails -v yesterday, everything worked fine.
I should note, that before testing out the Ubuntu sub-system, I've been using Ruby and Rails on Windows itself - In this case, I have Ruby 2.2.5 (64-bit) installed using an installer downloaded from here. I installed Rails on Windows by running gem install rails on the Windows command prompt.
I am on Windows 10 Home Version 1703 (OS Build 15063.483)
from your story above, probably how you start the terminal (command prompt)
if you run using go rails make sure your run the terminal with bash, press start, then search for bash then you click bash icon
if you using ruby from ruby installer / rails installer you search "command prompt with ruby and rails" and click the icon
Firstly install ruby using rvm manager. It enables you to switch between different ruby versions as per your project.
Follow the instructions on this website:
http://rvm.io/rvm/install
and install ruby through rvm.
For the problem of unable to detect ruby on your system change settings for your terminal through Edit->preferences/profile preferences -> command ->(tick mark) run command as login shell.
Running OSX Mavericks, ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0], rvm 1.25.23 (master), and rails-4.1.0 (allegedly)
I'm working through the railsapps.org book on learning rails and made it about 1/2 way through yesterday. When I stopped for the day, I closed out iTerm2 and shut off the Macbook Pro. Today, I powered up, opened iTerm, navigated to my working directory (~/rubyonrails/learn-ruby) and entered rails -v.
I see this:
`Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.`
So I run sudo gem install rails and it shows that it has installed rails-4.1.0. Now rails -v still gives me the same error message above.
I tried also running rvm use ruby-2.1.1#learn-rails first and I still get the error message.
So I'm a little stuck and I can't figure out what to do to get rails working. Also, how do I go about setting up the bash environment such that I don't have to go through this each time? It would be nice to nav to my working directory and just start work without having to do a bunch of re-installation and reconfiguration each time.
Regards,
Jeff
please type in your shell:
$ bash --login
and then repeat your commands.
rails -v
Also try to call it with the full path:
like:
/your/path/to/rails -v
I think that the shell just doesn't know where rvm/rails etc is located.
You can solve this by entering:
$ source ~/.rvm/scripts/rvm
When you switch to the ruby-2.1.1#learn-rails ruby/gemset combo, and do gem list, what do you see?
The way people usually use rvm is to have every project folder specify the ruby & gemset it uses (they don't all have to be different). This is done with files called .ruby-version and .ruby-gemset. These should contain, in your case, ruby-2.1.1 and learn-rails respectively.
Set these if you haven't already, then leave the folder and enter it again. Then do bundle install to install the gems for the project into the rvm/gemset combo.
Your problem is that you ran
sudo gem install rails
The error message telling you to do this comes from your system Ruby, which doesn't know that you want to use RVM.
RVM installs gems into your user-space directory. By using sudo, you're bypassing this and installing it into (effectively) the superuser space, i.e. globally.
If you instead just run
gem install rails
then you'll be using RVM's copy of the gem utility rather than the globally installed version.
I followed this to install ror,
https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm
after that, everything works fine(i think so),
but the strange thing is,
if i command rails in ubuntu terminal
it says install apt-get
however in aptana terminal,
it runs fine,
can i ask why it doesn't work in ubuntu default terminal?
do i have to setup some kind of path?
You need to change a few terminal profile preferences before you can start using rvm through gnome terminal.This article contains more information.
i am using ubuntu 12.04. I've installed rails with rvm. i added required lines to .bashrc and .bash_profile. however when i want to run rails terminal says:
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
i could run rails in my few attemps, but i used a different approach:
open a new terminal
logged as root sudo su
re-login my user account, login user
and it worked few times.
Had same problem, on my command line I fixed it by doing this
/bin/bash --login
hope it helps.
make sure:
rvm use ruby
works, follow all instructions displayed to you.
So here is what happened:
I started working for a company and was given a macbook pro for work. I do customer support for Exceptional/Airbrake so i need to learn Ruby/Rails. So the laptop had a previous owner and i dont know what he did with it.
I tried to install Ruby and Rails and kept getting errors, then tried doing it with rvm, and i thought it was working as i could run irb and even execute a test program with ruby. I got tired of seeing the previous owners name on the command line so i changed the home folder and I am pretty sure this is where things got bad. I took the contents of rvm and everything and moved it to my User file from the old one then deleted the old one.
Everything seemed to still be working fine, but when I wanted to start working with rails as well, t it wouldnt work.So i figured i would just uninstall everything and start over, i tried rvm implode and removed all gems. when i run 'gem list', i get empty, and i cant find ruby anywhere but when i run irb, it still works. so i tried re-installing using rvm, but i keep getting errors.
The first error that occurs is:
No binary rubies available for: osx/10.7/x86_64/ruby-2.0.0-p0.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
the second error is:
Error running 'env GEM_PATH=/Users/robertmroz/.rvm/gems/ruby-2.0.0-p0:/Users/robertmroz/.rvm/gems/ruby-2.0.0-p0#global:/Users/robertmroz/.rvm/gems/ruby-2.0.0-p0:/Users/robertmroz/.rvm/gems/ruby-2.0.0-p0#global GEM_HOME=/Users/robertmroz/.rvm/gems/ruby-2.0.0-p0 /Users/robertmroz/.rvm/rubies/ruby-2.0.0-p0/bin/ruby /Users/robertmroz/.rvm/src/rubygems-2.0.3/setup.rb', please read /Users/robertmroz/.rvm/log/ruby-2.0.0-p0/rubygems.install.log
and the last error is:
ERROR: Loading command: install (LoadError)
cannot load such file -- openssl
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
I have gone through dozens of google searches, most of them leading me here, on each of these errors, and sometimes the certain error seems to be fixed, but in the end i cant get it to work. Should i just wipe the OS and start over, cause I have been trying to get this done for days now.
BTW, i dont know why it is installing 2.0.0 i thought rvm installed the latest version by default.
Before you blow out the system I'd:
Uninstall rvm (rvm implode, gem uninstall rvm) see this question
You should be left with just the base ruby. That should be the only one left.
Re-install rvm (\curl -L https://get.rvm.io without Rails).
Install the ruby version you want with rvm (rvm install 1.9.2) stay away from 2.0 for now.
Make sure your ruby version is installed and selected.
Install the rails version you want.
Hopefully that will straighten things out.
I also suffered from the same problems while installing Ruby , but after googling a lot I found the solution . Follow the below process :
If you have already installed anything uninstall all of that using Revo installer or by some other means , else go to step 2.
Next go to http://rubyinstaller.org/ and press the download button .
You will find a list of ruby versions , click on the latest version ( If you are running a 64 bit machine install the link with (x-64) else install the one without brackets .
Accept all the defaults and tick all the check boxes after downloading and setting it up , it will install in C:\ with name Ruby22 ( depending on its version )
Go to start menu type cmd , the use the command "cd C:\" without brackets , it will take you the C:\ drive
Check ruby -v , you should get the version number , else repeat the above process again .
Now use the command "gem install rails" , it will install all the rails requirements , this takes a lot of time .
Now use the command "gem install webrick" to install the web server
Now go to some browser , visit http://rubyinstaller.org/downloads/ , download the DevKit at the bottom of the page and extract it to some folder ( ex in C:\DevKit after creating the DevKit folder in C:\ )
Use the following commands in the same order
"ruby dk.rb init"
"ruby dk.rb install"
"gem install rdiscount --platform=ruby"
Rails is installed now .
Create a folder in C:\ for creating your rails apps and name the folder ( ex Rails _Apps ) use the command cd C:\Rails_apps to go there and use the command "rails new sample_rails_app" to create a Rails app with the name "sample_rails_app" .
It does a bunch of things and you are now able to use Ruby on Rails.
Ruby 2.0.0-p0 was recently released, so that is the latest version technically, although I kind of doubt you really want the latest version since it is so new and your company may still be running an older version like 1.9.3. Have you tried installing 1.9.3-p392 (the current 1.9.3 version)?
If you still get the error with 1.9.3, I would try the instructions shown on the RVM site:
$ rvm pkg install openssl
$ rvm reinstall 1.9.2 --with-openssl-dir=$rvm_path/usr