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.
Related
Using ubuntu 10.04, rvm. At first, I've installed ruby 1.9.2 with rvm, gem rails and generated some new project and started it successfully. Everything was working fine. But after changing to another project, executing bundle install command (output looks OK) and starting rails server - error occurs:
rails s
/home/jacek/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/site_ruby/1.9.1/rubygems.rb:316:in `bin_path': can't find gem rails ([">= 0"]) with executable rails (Gem::GemNotFoundException)
from /home/jacek/.rvm/gems/ruby-1.9.2-p318/bin/rails:19:in `<main>'
gem list rails
*** LOCAL GEMS ***
rails (3.2.2)
gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.18
- RUBY VERSION: 1.9.2 (2012-02-14 patchlevel 318) [i686-linux]
- INSTALLATION DIRECTORY: /home/jacek/.rvm/gems/ruby-1.9.2-p318
- RUBY EXECUTABLE: /home/jacek/.rvm/rubies/ruby-1.9.2-p318/bin/ruby
- EXECUTABLE DIRECTORY: /home/jacek/.rvm/gems/ruby-1.9.2-p318/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /home/jacek/.rvm/gems/ruby-1.9.2-p318
- /home/jacek/.rvm/gems/ruby-1.9.2-p318#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
My Path (includes EXECUTABLE DIRECTORY: /home/jacek/.rvm/gems/ruby-1.9.2-p318/bin )
/home/jacek/.rvm/gems/ruby-1.9.2-p318/bin:/home/jacek/.rvm/gems/ruby-1.9.2-p318#global/bin:/home/jacek/.rvm/rubies/ruby-1.9.2-p318/bin:/home/jacek/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
I would be grateful for any help
For me just installed bundler. This makes everything work again.
gem install bundler --no-ri --no-rdoc
If you use the command bundle install to install your gems off of a GEMFILE, it will install the gems into your default system location for gems, as outlined in the bundler docs here. After that, you can use bundlers bundle exec command to execute a command in the context of the bundle, as outlined in the docs here. This will ensure that the version of the gem you installed using bundle install is executed.
If you look at the homepage for bundler, which provides an overview of the docs, it states the following:
In some cases, running executables without bundle exec may work, if the executable happens to be installed in your system and does not pull in any gems that conflict with your bundle.
However, this is unreliable and is the source of considerable pain. Even if it looks like it works, it may not work in the future or on another machine.
I'm guessing that you run gem which rails in your console, and then run bundle show rails in your console, the default installed rails installation for your system differs from the one installed for your bundle.
You say that you are using rvm for your ruby and gem management. I'm thinking you may not have properly configured it. Trying executing the rvm notes command in your console to ensure that you have addressed all of the required/recommended steps for installation on your OS. You want to ensure that the executables for rvm are the first things included in your path when you run echo $PATH ideally. This will ensure that the gems installed for rvm will be the ones executed when you try executing them without prefixing bundle exec. If rvm notes doesn't give you the hints necessary to accomplish that, then try carefully reviewing the docs for installation on the RVM website.
You can switch version between Ruby with $ rvm use --default 2.4.0 for example
But for your problem try this :
$ gem install bundler
$ gem install rails
Hope it helps !
I think below command will work
gem pristine rails
issue => can't find gem rails - Gem::GemNotFoundException
Solution for Mac M1 Chip
Remove Gemfile.lock
run rm Gemfile.lock
run bundle install
run pod update && pod install
I had a RoR app working fun under Fedora14, I upgraded to Fedora16 and now it's a broken mess.
This is due to a change in the rails used, with Fedora 14 running on 2.x and now Fedora 15/16 running 3.x
I have rvm installed, previously I didn't have the rails gem installed, so it would fall back to the system(?). So I've installed the gem for rails 2.3.8, it shows up when I do a gem list however the app is still a broken mess.
Anyone have any sort of clue here, what I should check, do, smash?
So I added this, to my config/enviroment.rb
config.gem "rails", :version => "~> 2.3.8"
and when I start I now get this error (this was all on one line).
Error message:
NOTE: Gem.source_index is deprecated, use Specification.
It will be removed on or after 2011-11-01. Gem.source_index called from /var/work_sites/mysite/vendor/rails/railties/lib/rails/gem_dependency.rb:106.
NOTE: Gem::SourceIndex#search is deprecated with no replacement.
It will be removed on or after 2011-11-01. Gem::SourceIndex#search called from /var/work_sites/mysite/vendor/rails/railties/lib/rails/gem_dependency.rb:106.
Missing these required gems: rails ~> 2.3.8 You're running: ruby 1.8.7.357 at /usr/bin/ruby rubygems 1.8.11 at /usr/lib/ruby/gems/1.8, /home/nick/.gem/ruby/1.8 Run `rake gems:install` to install the missing gems.
however
$ gem list
*** LOCAL GEMS ***
...
rails (2.3.8)
....
so I try anyway;
$ rake gems:install
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
Missing these required gems:
rails ~> 2.3.8
You're running:
ruby 1.8.7.352 at /home/nick/.rvm/rubies/ruby-1.8.7-p352/bin/ruby
rubygems 1.8.10 at /home/nick/.rvm/gems/ruby-1.8.7-p352, /home/nick/.rvm/gems/ruby-1.8.7-p352#global
Run `rake gems:install` to install the missing gems.
ARGHH!
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.10
- RUBY VERSION: 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/nick/.rvm/gems/ruby-1.8.7-p352
- RUBY EXECUTABLE: /home/nick/.rvm/rubies/ruby-1.8.7-p352/bin/ruby
- EXECUTABLE DIRECTORY: /home/nick/.rvm/gems/ruby-1.8.7-p352/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/nick/.rvm/gems/ruby-1.8.7-p352
- /home/nick/.rvm/gems/ruby-1.8.7-p352#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
If the application is "reasonable sized" (mileage may vary), use this opportunity to upgrade to rails 3. Rails 4 will be out this spring and you will find no better time than now to do the upgrade. I would do v3.0.11 initially and go to 3.1.x if it goes well.
Face it, you don't want to do this again soon. At this point you will also find that whatever problems you encounter have usually be met and fixed by others and findable on the net, thru SO, etc.
These will help:
http://railscasts.com/episodes/225-upgrading-to-rails-3-part-1
http://ryanbigg.com/2010/11/the-rails-3-upgrade/
http://www.railsupgradehandbook.com/ ($12)
Ruby and Rails are changing very rapidly and keeping somewhat current is really important, not justa 'nice-to-have'. At this point gems's are more in line with rails 3
While you are at it you should install ruby 1.9.3 It's quite likely you will have few issues with that unless the code has complex ruby. Ruby 2.0 will be out soon after all.
As others advise rvm is the key to managing ruby versions. Once you have it installed you can switch ruby versions with command as simple as rvm use 1.9.2 and you can create a .rvrmc file in the root of project to set the ruby version for that project.
Once of the things you need to do other than install a gem is put itin your environment file(s) - rails 2 or in your Gemfile and Bundle - rails 3
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!
I am having problems with conflicting versions of Ruby that I have installed. I had 1.8.6 and then installed 1.8.7 and it has caused problems. I get the following error when trying to run my ruby on rails app:
/usr/local/lib/ruby/1.8/i686-linux/rbconfig.rb:7: ruby lib version (1.8.6) doesn't match executable version (1.8.7) (RuntimeError)
I would like to remove 1.8.7 somehow and just use 1.8.6 but have no idea how to go about doing this.
Ran into this same issue and thought I'ld share my findings. There was a 1.8.7 ruby version installed by an rpm (centos 6.3), and I compiled 1.9.3 from sources and put it in a directory /opt/upnxt/ruby. I changed my environment to:
export PATH=/opt/upnxt/ruby/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
export LD_LIBRARY_PATH=/opt/upnxt/ruby/lib64
export RUBYPATH=/opt/upnxt/ruby/bin
export RUBY_HOME=/opt/upnxt/ruby
export RUBYLIB=/opt/upnxt/ruby/lib64/ruby/1.9.1:/opt/upnxt/ruby/lib64/ruby/1.9.1/x86_64-linux
export GEM_HOME=/opt/upnxt/ruby/lib64/ruby/1.9.1
export GEM_PATH=/opt/upnxt/ruby/lib64/ruby/1.9.1:/opt/upnxt/ruby/lib64/ruby/gems/1.9.1
and then when running:
$ ruby /opt/upnxt/ruby/bin/gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23
- RUBY VERSION: 1.9.3 (2012-11-10 patchlevel 327) [x86_64-linux]
- INSTALLATION DIRECTORY: /opt/upnxt/ruby/lib64/ruby/1.9.1
- RUBY EXECUTABLE: /usr/bin/ruby
- EXECUTABLE DIRECTORY: /opt/upnxt/ruby/lib64/ruby/1.9.1/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /opt/upnxt/ruby/lib64/ruby/1.9.1
- /opt/upnxt/ruby/lib64/ruby/gems/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
When running without the 'ruby' command in front, I would get:
$ /opt/upnxt/ruby/bin/gem environment
/opt/upnxt/ruby/lib64/ruby/1.9.1/x86_64-linux/rbconfig.rb:7: ruby lib version (1.9.3) doesn't match executable version (1.8.7) (RuntimeError)
from /opt/upnxt/ruby/lib64/ruby/1.9.1/rubygems.rb:31:in `require'
from /opt/upnxt/ruby/lib64/ruby/1.9.1/rubygems.rb:31
from /opt/upnxt/ruby/bin/gem:8:in `require'
from /opt/upnxt/ruby/bin/gem:8
because of the default #!/usr/bin/ruby as stated earlier. I guess that's why one should use "#!/bin/env ruby" as a shebang instead (or "#!/usr/bin/env ruby")
If someone can tell me how to change the "RUBY EXECUTABLE" from the "gem environment" output so I won't need to specify it on the commandline, I would be grateful
cheers,
Gerrit
Yes, setting the path:
export PATH=yourrubypath/bin:$PATH
should do it.
I recommend you install rvm, that way you can run different ruby versions and manage gem sets in a very easy way
The installation instructions are here. However it basically reduces to:
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
Then you can install a newer ruby from source (it will compile it!):
$ rvm install 1.9.1 ; rvm 1.9.1
$ ruby -v
ruby 1.9.1p243 (2009-07-16 revision 24175) [x86_64-linux]
$ which ruby
/home/you/.rvm/ruby-1.9.1-p243/bin/ruby
You can go back to the "system" one doing:
$ rvm system
Just change your $PATH to point to the version you want.
I install ruby from the tarball (and not from the distribuition package). This way I can have several different versions working at the same time, I have just to update the $PATH in the session that I want to use a different version.
Your easiest path and future proof too would be using rvm. Download the version of ruby you want with rvm and make it the default.
Installation: http://rvm.beginrescueend.com/rvm/install/
Making it default:
rvm 1.8.6 --default
The whole process would take not more than 15 minutes. Everything is clearly explained in this. Your environment will be set before you finish watching this podcast:
http://railscasts.com/episodes/200-rails-3-beta-and-rvm
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