Mac OS X Mountain Lion “Rails is not currently installed on this system.”

烂漫一生 提交于 2019-12-02 19:36:00

Use RVM http://rvm.io or rbenv to install newer Rails versions than what come pre-installed with OS X.

Follow examples on the site https://rvm.io/rvm/install/ but basically:

Install RVM: $ \curl -L https://get.rvm.io | bash -s stable

You can then $rvm list known to see what Rubies are available to you (lots). And simply $rvm install 1.9.3 to get the most current version of Ruby (which as of this writing is ruby-1.9.3-p327)

Set that ruby as your default $rvm --default use 1.9.3

Create a default gemset to store your gems $rvm use 1.9.3@mygemset --create --default

Then install Rails $ gem install rails will get you current which today is same as typing gem install rails -v 3.2.9

If you're using rbenv, don't forget to rbenv rehash after installing/updating ruby.

Just had this issue using rbenv, no idea how this happened, but figured that my ~/.rbenv/shims/rails was empty...

So to fix this:

  • Cleaned empty shims: find ~/.rbenv/shims -empty -delete

  • Then regenerate: rbenv rehash (was not overwriting empty one...)

I had the same problem.

After typing:

sudo gem install rails

and installing rails correctly, just close the Terminal window and open again. Then type:

~ $ rails -v
Rails 4.0.2

So, reseting the Terminal window fix the problem.

I think install rvm that will help you

  rvm get head && rvm reload
  rvm install 1.9.3
  rvm use 1.9.3@current --create --default 

The last line creates a gem set called current.

Now check to make sure you RubyGems was installed correctly by typing which gem in your terminal. Now update your gems.

gem update --system 1.8.24

Finally install rails.

gem install rails -v 3.2.3

I hope this works, let me know if you have any issues.

Yes, OSX comes standard with a lot of great software for Ruby on Rails, as well as PHP, Mysql, etc. However, sometimes it's better for sustainment purposes to use a 3rd party installer to get everything you want without digging through your /usr/ directory.

I recommend checking out http://railsinstaller.org/

With one easy install, you have everything you could want for a Rails project, including common software people use, and the site even has a tutorial. I recommend going this way. It saves you time. Plus, it comes with an easy uninstaller that it will put in your Applications folder to remove if you're not happy with the configuration. Enjoy.

Actually, /usr/bin/rails script is just a

# Stub rails command to load rails from Gems or print an error if not installed.

(Comment quoted from the very script's source)

If Rails is installed, then it is loaded. Else, the script will throw the error you pasted in your question.

Yet, another alternative to RVM is the awesome rbenv tool.

It is very easy to install (just a simple brew install rbenv) and work with. In my opinion, it is the best way to manage your rubies on a Mac.

However, if you have rvm installed on your machine already, consider removing it from your system by doing rvm implode.

Since setting up a fresh ruby on rails dev environment is a common barrier to most newbies (including myself when i started off with rails) I've put together detailed instructions on how to do exactly that in a blog post, which i will link to below. Hope you will find it useful.

http://blog.parsalabs.com/blog/2013/08/27/setting-up-a-ruby-on-rails-4-development-environment-on-a-clean-mac-os-x-installation/

i got the same error and uninstall rvm then i follow the instructions on this page https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm

i think that help was

rvm requirements

on the terminal.

Our company uses a script to setup each new machine with a Rails dev environment:

We've open source it, give it a try: https://github.com/platform45/let-there-be-light

After a new

gem install rails

do

rbenv rehash

It worked for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!