Having some real difficulty setting up my RoR envirionment in Ubuntu 10.10
Installed RVM with ruby 1.9.2
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
and i have ruby gems setup
RubyGems Environment:
- RUBYGEMS VERSION: 1.6.2
- RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180) [i686-linux]
- INSTALLATION DIRECTORY: /home/toast/.rvm/gems/ruby-1.9.2-p180
- RUBY EXECUTABLE: /home/toast/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
- EXECUTABLE DIRECTORY: /home/toast/.rvm/gems/ruby-1.9.2-p180/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /home/toast/.rvm/gems/ruby-1.9.2-p180
- /home/toast/.rvm/gems/ruby-1.9.2-p180#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
Now when it came to installing Rails i had all sorts of difficulties but now it seems to install:
$ sudo gem install rails
Successfully installed rails-3.0.7
1 gem installed
Installing ri documentation for rails-3.0.7...
Installing RDoc documentation for rails-3.0.7...
yet rails commands fail and rails -v results in
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
I'm out of ideas on this one!
many thanks
You've installed Rails under root user (sudo), and then you are trying to use it under local user. As far as it installed to root user you haven't got rails command in your local user PATH.
What you can do
Add its Path manualy
Install it via local user
Use RVM
I prefer to use RVM.
As far as you are using RVM, you don't need to use sudo. But when you need it you can use rvmsudo, but not in this case. Just
gem install rails
You don't have to use sudo with RVM.
If you type rvm info, you will see what ruby you use and where are your gems stored.
With sudo, you are probably using system's ruby from Ubuntu package.
Jus try gem install rails.
As others have said you need to install rails from gem via
gem install rails
The other somewhat tricky thing is that when you change into the rails app directory you need to make sure the dependencies are met for that app by doing:
bundle install
I've gone into a bit more detail on getting Rails 3 set up under Ubuntu at http://blog.dcxn.com/2011/06/21/rolling-with-rails-3-on-ubuntu-11-04/
Good luck!
Related
I'm just getting started with Ruby on Rails, so I apologize if I'm missing something horribly basic here...
Through some reading (and complaints from Rails), I've seen a lot of recommendations to install Ruby/Gem >v1.9. I upgraded whatever version Ruby was on my Ubuntu 14.04 machine to v1.9.3, but my version of Gem refuses to upgrade beyond 1.8.23.
The gem executable is labeled /usr/bin/gem1.9.1, but when you ask it for its version or dump the environment it returns 1.8.23. Rails seems to have installed fine with it as 1.8.23, but whines at me to upgrade whenever I generated a new project.
$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
$ /usr/bin/gem1.9.1 -v
1.8.23
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23
- RUBY VERSION: 1.9.3 (2013-11-22 patchlevel 484) [x86_64-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
- RUBY EXECUTABLE: /usr/bin/ruby1.9.1
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /var/lib/gems/1.9.1
- /home/andy/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
I installed ruby with sudo apt-get ruby-dev, which seems to be what folks are saying is correct for Ubuntu. At one point I tried sudo apt-get ruby-full, as recommended by ruby-lang.org but that didn't seem to work either.
I'm trying to make sure I set this up correctly, so I don't get too deep into development and realize I borked my environment from the get-go. Should I just give up on apt-get and install from source, or is there something else that I did wrong?
Thanks
Use rubygems-update:
gem install rubygems-update
update_rubygems
gem update --system
When I tries to install rails:
root#li44-48:/# gem install rails
Successfully installed rails-3.2.1
1 gem installed
Installing ri documentation for rails-3.2.1...
Installing RDoc documentation for rails-3.2.1...
But when I do:
root#li44-48:/# rails
-bash: rails: command not found
I checked gem env and it displays:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.15
- RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [i686-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /usr/lib/ruby/gems/1.9.1
- /root/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
Also the folder root#li44-48:/usr/lib/ruby/gems/1.9.1/gems/rails-3.2.1# is empty.
Any ideas on how to fix this?
I had the same issue after switching to an older version of Rails (3.2.16) from 4.0.2.
In my case it looks like railties need to be uninstalled as well - not just the rails gem.
Here's what I've done:
gem uninstall rails # choose to remove all
gem uninstall railties # choose to remove all
gem install rails -v 3.2.16
This happened to me after I uninstalled an old version of rails, and it asked me if I wanted to remove the binary too (which I did).
The newer rails binary is hidden under
/var/lib/gems/1.9.1/gems/railties-3.2.13/bin/rails
(on Ubuntu)
So I just created the symlink (not sure if this has negative side affects but it seems to work):
sudo ln -s /var/lib/gems/1.9.1/gems/railties-3.2.13/bin/rails /usr/local/bin
In an effort of rage quit, I:
removed ruby
removed gem
and recompiled both from source, and now gem install rails is fully working again.
I had the same issue and ended up using the RVM installer. This post http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/ shows you how and why use this tool.
check that rvm is a function type rvm | head -1
Try installing with:
sudo gem install rails
If you are running RVM you may not have it configured properly.
Whether I use gem install or bundle install for my gems, they don't work. Sometimes sudo gem install gets gems to work. I ran the gem list -d and which gem commands, and it seems that my system is configured such that all the gems get installed into " /Library/Ruby/Gems/1.8" but my environment expects them in "/usr/bin/gem". How could I properly correct this? I was under the impression that 'bundle' should be able to install a local, application specific copy of a gem?
Although many Rubyists will recommend you RVM or RBENV, I do not use it. It's VERY slow and it pollutes your environment.
If you use Bundler, you dont need RVM at all - rubygem itself supports multiple versions of single gems. So you can just start using gems (e.g. gem install etc) and it will install into your $HOME/.gem directory by default. You can check the installation path using:
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.25
- RUBY VERSION: 1.9.3 (2013-02-06 patchlevel 385) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/lzap/.gem/ruby/1.9.3
- RUBY EXECUTABLE: /usr/bin/ruby
- EXECUTABLE DIRECTORY: /home/lzap/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/lzap/.gem/ruby/1.9.3
- /usr/share/gems
- /usr/local/share/gems
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "install" => "--no-rdoc --no-ri"
- REMOTE SOURCES:
- http://rubygems.org/
You can even change this with GEM_HOME environment variable. Happy gemming!
I would suggest using RVM (Ruby Version Manager) to control which version of Ruby you are installing your gems into. It will also help keep all the bundle and gem data in a folder in your home directory.
Running Snow Leopard.
Tried uninstalling, and re-installing.
Still getting the same error whenever I run a rake task.
mbpro:redmine shereef$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel
174) [i686-darwin10.0.0]
mbpro:redmine shereef$ rails -v
Rails 2.3.4
mbpro:redmine shereef$ which rails
/usr/local/bin/rails
mbpro:redmine shereef$ gem -v
1.3.5
mbpro:redmine shereef$ which gem
/usr/local/bin/gem
mbpro:redmine shereef$ rake -v
(in /Users/shereef/Documents/Code/BetterMeans/redmine)
Missing the Rails
2.3.4 gem. Please gem install -v=2.3.4 rails, update your
RAILS_GEM_VERSION setting in config/environment.rb for the Rails
version you do have installed, or comment out RAILS_GEM_VERSION to
use the latest version installed.
mbpro:redmine shereef$ which rake
/usr/bin/rake
mbpro:redmine shereef$ $PATH
-bash:
/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:
No such file or directory
mbpro:redmine shereef$
On Fedora 12 you need to
$ gem install -v=1.0.1 rack
for the bundled rails to work.
Have you tried running rake:rails:update in your application?
I too had faced a similar issue. Please verify whether rails 2.3.4 is installed properly using the "gem list" command. If more than one copy of rails are present in gem list, remove the unwanted version using "gem uninstall rails" and select the required version.
Whenever I installed a newer version of rack this would happen. Making sure I had v 1.0.1 made it always work.
The solution that worked for me was to remove ruby 1.8.7, reinstall it and use gemsets.
This is the code if you're using rvm and ruby is correctly on it.
rvm remove 1.8.7
rvm package install readline # I'm not sure this is needed...
rvm install 1.8.7 --with-readline-dir=$rvm_path/usr # same here for option
rvm gemset create mine
rvm 1.8.7#mine
rvm use 1.8.7#mine --default # IF you do not want to change rv each terminal
gem install rails -v=2.3.5
I'm not sure but I think that rails was not seen because of the global gemset, but rails is pretty new to me to go deep in the explanation.
Edit:
In the case that there is no need to reinstall ruby, this should be enough, in both cases you'll have to reinstall all your gems.
rvm gemset create mine
rvm 1.8.7#mine
rvm use 1.8.7#mine --default # IF you do not want to change rv each terminal
gem install rails -v=2.3.5
let me know...
Since you have your own copy of ruby in /usr/local, I suspect that somehow rake is still trying to use the builtin os x ruby/gem command.
Try running 'gem env' to make sure your environment is set up correctly. In particular, look at the GEM PATHS: to make sure they are pointed at your /usr/local directory. If they are wrong try setting GEM_HOME and/or GEM_PATH in your environment.
Here is what my output looks like (though I use a ruby install dir in my own how directory via the ruby_switcher.sh tool (http://github.com/relevance/etc)
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.5
- RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0]
- INSTALLATION DIRECTORY: /Users/ashebanow/.gem/ruby/1.8
- RUBY EXECUTABLE: /Users/ashebanow/.ruby_versions/ruby-1.8.7-p174/bin/ruby
- EXECUTABLE DIRECTORY: /Users/ashebanow/.gem/ruby/1.8/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-darwin-10
- GEM PATHS:
- /Users/ashebanow/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.rubyforge.org/", "http://gems.github.com/"]
- REMOTE SOURCES:
- http://gems.rubyforge.org/
- http://gems.github.com/
I had similar problems, and another gem to keep an eye on is activesupport. I found if I had other versions that differed from my Rails version, it could cause this as well.
I just set up a fresh Mac OS X 10.5 environment for Rails. I installed Ruby 1.8.7, renamed the packaged version of Ruby in /usr/bin, and updated the packaged version of RubyGems from 1.0.1 to 1.3.4. Here's the flow:
$ rails -v
Rails 2.3.4
$ gem -v
1.3.4
$ which gem
/usr/bin/gem
$ whereis gem
/usr/bin/gem
$ which rails
/usr/bin/rails
$ whereis rails
/usr/bin/rails
$ /usr/bin/gem -v
1.3.4
$ /usr/bin/rails -v
Rails 2.3.4
$ rails testapp
...
...
testapp $ script/console
Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org
The thing is I've updated RubyGems and didn't install another version of it. gem list rails displays two versions of Rails (2.3.4 and 1.2.6), though.
How can I fix this so I can use Rails?
One suggestion is to not change the system versions, instead install in /usr/local or use MacPorts.
The guys over at HiveLogic cover Rails, as well as MySQL and other development tools.
Using these techniques i've successfully installed rails into /usr/local Then it's a simple matter of adjusting the path settings in your terminal shell via (export PATH=/usr/local/bin:$PATH)
Have you tried:
sudo gem update --system
That should get you the latest version of rubygems, which is something like 1.3.5.
Rails will tell you the version of RubyGems you have if it's loading an incompatible version. The error message you're getting means it can't load RubyGems at all, so I'm thinking it's a path issue.
What do you get from $: in irb? Is there a rubygems.rb in any of those locations?
Make your life easier and use Macports instead of trying updatre and repalce the core system libraries. :-)
I second that emotion and, if I could, would up-vote the answer from prodigitalson -- MacPorts is your friend... Recommend you run specifically:
$ sudo port install rubygem
$ gem install rails
Key is making your which ruby and your rubygems which gem in synch. and in harmony...both should be in /opt/local/bin/
So Ruby on Rails 2.3.8 working on my MacOS 10.5.8 - and the gem environment no longer lies after the MacPorts install and reports the correct version, 1.8.7.
$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.4
- RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9]
- INSTALLATION DIRECTORY: /opt/local/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /opt/local/bin/ruby
- EXECUTABLE DIRECTORY: /opt/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-darwin-9
- GEM PATHS:
- /opt/local/lib/ruby/gems/1.8
- /Users/saleram/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://gems.rubyforge.org/
Though the question is rather old, and comments stale, current searchers may find that these instructions:
Installing Rails on Mac OS X 10.6 (SL)
work fine for installing Ruby / Rails 3 on new OS X 10.6 installs, GIVEN that you install a recent version of RubyGems:
http://rubyforge.org/frs/?group_id=126
... particularly, do this in place of typing
sudo update_rubygems
in the first of my links
Had the same problem, here's what I did that solved it:
First, update gem
gem update --system
Navigate to the primary path in gem env, in my case /Library/Ruby/Gems/1.8
cd /Library/Ruby/Gems/1.8
Then, navigate to the gem itself:
cd gems/rubygems-update-1.3.5
Run setup.rb
sudo setup.rb
And that's it.
Have you considered BitNami Rubystack as an alternative? It is a free installer that provides a out-of-the-box Rails environment with MySQL (and a bunch of preconfigured, commonly used third-party libraries and apps). Please note I am one of the contributors to RubyStack, so I am biased. It is free and distributed under the Apache 2.0 open source license