I have rails 3 installed with rvm and today i tried to add the alias 'subl' (from Sublime Text 2) to use on terminal. The problem is the 'subl' command works and i think i messed up with the paths, because the rails command is not found anymore.
How do I find the correct rails path and fix this problem?
Thanks in advance.
Depends on your setup. If you're using rvm, it will probably be
~/.rvm/gems/<ruby version that you use>/bin/rails
If you're using the system ruby, then have a look in the gems folder of wherever your ruby install is, and add that to the path. On windows, the ruby installer generally puts it in
C:\Ruby
Or something like that. On Mac, the default system ruby is
/usr/bin/ruby
Related
I installed Ruby and Rails and set-up the PATH to "C:\Rails\Ruby2.3.0\bin", but when I try to run commands with rails, I get the error message:
The System cannot find the path specified.
I am able to run commands using ruby, and rails works if I use GitBash. How do I make it work on my normal command line?
Had the same problem here, installed the same way. Couldn't even run rails commands on GitBash, only way was going in C:\Rails\Ruby2.3.0\binthrough cmd and typing, for example, ruby rails new projectname. The rails new projectnamewouldn't work even in these conditions.
What I did was going in the Command Prompt with Ruby and Rails and entered gem install rails (which did not work on cmd). I also did gem install bundle. Both installed successfully and that fixed all consoles for me: cmd, GitBash (wasn't working for me), Command Prompt with Ruby and Rails and even cmder works with Rails now.
Hope this helps you.
Cheers.
If it's a simple question of locating the rails executable on Windows, then on later installs that use msys64 instead of DevKit, you'll find rails at the following folder:
c:\msys64\o-rdoc
Add this to your PATH or execute from that folder.
Your path may vary on 32-bit systems or if you changed the default install folder.
Forgive me if there's a duplicate, but I'm honestly not sure what to search for. I'm working on a project with Ruby on Rails, and I get this message when doing anything related (ie: rake, rails, rspec, etc.):
Your Ruby version is 2.1.5, but your Gemfile specified 2.2.3
Now, I've installed RVM and I can fix this issue by issuing the command
bash --login
edit for clarity
running the above command does use Ruby 2.2.3 to execute the commands.
/edit
Then those given commands work. What I would like to do is to remove version 2.1.5 entirely -- leaving only 2.2.3. I've gone about this so many different ways, but Ruby is pretty foreign territory to me so I'm not sure what to do about this. I'm sure I have at least three installations of Ruby on my machine - possibly two duplicates of the two versions I know I have - and I would like only one version and to avoid needing to enter the bash --login command in order to run my project.
I'm running Ubuntu 15.10 and have at least some knowledge of how this works. If somebody could walk me through removing everything related to Ruby & Ruby on Rails, then installing only Ruby 2.2.3 and Rails 4.2.4, I would greatly appreciate that. Let me know if this isn't the proper exchange for this question. It didn't quite seem to fit into Ubuntu or Sysadmin.
What you need to do is not try to remove ruby 2.1.5.
You have RVM, so, use that to get the new version you want.
After this, you now have two options:
1) make the newly installed version the global default version on your machine,
or
2) create a gemset for your project, and specify the needed ruby version for the project.
Either of these will fix your problem.
You have to modify the Gemfile.
http://bundler.io/v1.3/gemfile_ruby.html
I try to delete all ruby related folders and gems. Do you know hoe to find all these and where is the ruby directory in ubuntu?
To remove all gems, follow this page:
http://geekystuff.net/2009/01/14/remove-all-ruby-gems/
Works like a charm
So I was following the steps on Hivelogic to get ruby on rails setup on my machine. After compiling and installing, I used the which ruby command to double check it installed in the right place. It did not. I was able to install the Rails and MySQL gems though, but both POW and localhost:3000 don't work.
Is there anything wrong with having it in the usr/bin directory instead of usr/local/bin? My usr/local/bin is practically empty, but usr/bin has a ton of files in it.
Edit: I reinstalled ruby to usr/local/bin but now Rails won't install. Is it a problem that it's already installed in usr/bin?
That page is a few years old. The current best practice for Mac and Linux is to use rvm. You can see, even Hivelogic uses rvm now (though I'm not sure how I feel about installing it system wide).
Anything that recommends installing from source as the first option instead of a last-resort fallback is probably bad advice. It's better to install using a package manager like MacPorts or Homebrew both of which have current versions of Ruby 1.8 and 1.9.
MacPorts installs everything in /opt specifically to avoid conflict with system files. From time to time Apple will distribute an update that patches ruby and this can mess up anything you have in the way of dependencies if you've been using a modified /usr/bin/ruby. Generally the system ruby is supposed to be left as-is.
You can replace the "compile ruby" step with an installer like that and save yourself a lot of trouble in the future. Just be sure to have /opt/local/bin as one of the first items in your PATH just as you would for other solutions.
Since installing Ruby and Rails and some kind of database can be a confusing process, it seems like there should be a meta-installer to help you through the process.
So I finally managed to get rails installed in the correct spot. I had to change the line in my .profile to export PATH="/usr/local/bin:$PATH" and then do a sudo gem update --system after installing rubygems before rails could actually be installed.
RVM and Homebrew did not help at all.
EDIT: Since people have a problem with this answer, I'm giving an update. I have since installed RVM and am liking it, but only because I have a friend I ask all my questions to, as RVM is really confusing if you're not used to doing a lot on the command line. I needed help from him to install it because I didn't have any of the bash files, and thought they were hiding somewhere. If you're missing the bash files, just create them yourself. This took a long time to get working, but now I apparently have it setup right.
How do I properly setup Aptana RadRails if I've installed Rails through RVM?
I followed the install on http://railstutorial.org/ but my script paths don't work: e.g.:
'rails' path: /home/marius/.rvm/gems/ruby-1.8.7-p302#rails3gemset/bin/rails
Detected path: Not Detected
After installing ruby through rvm, I was able to get eclipse to use that install by:
In Eclipse, go to Window -> Preferences.
In the Ruby/Interpreters tab click "Search"
For me this found all of the ruby installs from rvm, and it added them to the interpreters list. I edited the "Name" field to include the version number for convenience.
try to run this in the command line. It will show you real path to the available rail script for current environment.
$ which rails
In Aptana Studio 3 (build: 3.0.8.201201201658) there is no Window -> preferences. If you have a .rvmrc in your project work directory, stating for instance:
rvm use ruby-1.9.3-p0#mygemset
... then Aptana should pick up the correct environment; in this case using ruby-1.9.3-p0 with gemset mygemset. Don't forget to run build install or build update (when you updated your Gemfile) from your project working directory path.
I must add that Aptana Studio 3 seems a bit buggy when it comes to picking up the correct environment, especially when trying to use ruby-debug-ide19.
Did you try with just /home/marius/.rvm/gems/ruby-1.8.7-p302/bin/rails ?
You have to run eclipse/aptana from a terminal session.
Without RVM :
Please type command whereis ruby in console.
you will get the path like /usr/bin/ruby or /usr/local/bin/ruby to check which is correct interpreter path /usr/bin/ruby -v if you get version. that is your interpreter.
With RVM :
Please type command: rvm info
binaries:
ruby: "/home/<USERNAME>/.rvm/rubies/ruby-2.0.0-p247/bin/ruby"
copy this path and paste wherever you need enter you interpreter path.
It worked for me. and I hope it will help others as well.
Cheers!