Difference between revisions of "Rails"

From TaxonWorks Wiki
Jump to: navigation, search
(Created page with " * [http://api.rubyonrails.org/ Rails API] * [http://edgeguides.rubyonrails.org/ Rails Guides] * [http://pragprog.com/book/rails4/agile-web-development-with-rails-4 Pragmatic...")
 
(Ran into a problem installing Rails on MacOS X, so I'm documenting it!)
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
 
 
 
* [http://api.rubyonrails.org/ Rails API]
 
* [http://api.rubyonrails.org/ Rails API]
 
* [http://edgeguides.rubyonrails.org/ Rails Guides]
 
* [http://edgeguides.rubyonrails.org/ Rails Guides]
 
* [http://pragprog.com/book/rails4/agile-web-development-with-rails-4 Pragmatic Programmers Rails 4]
 
* [http://pragprog.com/book/rails4/agile-web-development-with-rails-4 Pragmatic Programmers Rails 4]
 
* [http://railscasts.com/‎ Railscasts]
 
* [http://railscasts.com/‎ Railscasts]
 +
 +
== Installing Rails 4.0 on MacOS X ==
 +
# Get [http://brew.sh/ Homebrew].
 +
#* Homebrew installs software into /usr/local, so you might need sudo-powers to install it, but -- once installed -- all Homebrew installations shouldn't need sudo at all.
 +
# <code>brew install ruby</code>
 +
#* Since this will install Ruby into /usr/local, OS X's system Ruby (1.8.7) will be untouched.
 +
#* Run <code>ruby --version</code> to make sure you have Ruby 2.0.
 +
# Add <code>/usr/local/Cellar/ruby/2.0.0-p0/bin</code> to your PATH (mine is in <code>~/.bash_profile</code>). You need to open a new terminal or start a new shell after this.
 +
#* If you miss this step (like I did), running <code>rails</code> will call your system rails (<code>/usr/bin/rails</code>), which will ask you to install rails using sudo. Don't believe it.
 +
# <code>gem install rails</code>
 +
#* If this step works correctly, the <code>rails</code> binary will be installed into <code>/usr/local/Cellar/ruby/2.0.0-p0/bin</code>, so if that's in your path, running <code>rails -v</code> will report that you have rails 4.0 installed.
 +
# Use <code>which rails</code> to make sure your path to the <code>rails</code> binary is correct -- it should *not* be in <code>/usr/bin</code>!
  
 
== Related Ruby stuff ==
 
== Related Ruby stuff ==
 
* [https://rvm.io/ Ruby Version Manager]
 
* [https://rvm.io/ Ruby Version Manager]
 
* [https://www.ruby-toolbox.com/ Ruby Toolbox]
 
* [https://www.ruby-toolbox.com/ Ruby Toolbox]

Latest revision as of 19:11, 26 September 2013

Installing Rails 4.0 on MacOS X

  1. Get Homebrew.
    • Homebrew installs software into /usr/local, so you might need sudo-powers to install it, but -- once installed -- all Homebrew installations shouldn't need sudo at all.
  2. brew install ruby
    • Since this will install Ruby into /usr/local, OS X's system Ruby (1.8.7) will be untouched.
    • Run ruby --version to make sure you have Ruby 2.0.
  3. Add /usr/local/Cellar/ruby/2.0.0-p0/bin to your PATH (mine is in ~/.bash_profile). You need to open a new terminal or start a new shell after this.
    • If you miss this step (like I did), running rails will call your system rails (/usr/bin/rails), which will ask you to install rails using sudo. Don't believe it.
  4. gem install rails
    • If this step works correctly, the rails binary will be installed into /usr/local/Cellar/ruby/2.0.0-p0/bin, so if that's in your path, running rails -v will report that you have rails 4.0 installed.
  5. Use which rails to make sure your path to the rails binary is correct -- it should *not* be in /usr/bin!

Related Ruby stuff