Skip to content

Instantly share code, notes, and snippets.

@solnic
Created March 29, 2012 12:33
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save solnic/2237029 to your computer and use it in GitHub Desktop.
Save solnic/2237029 to your computer and use it in GitHub Desktop.
6 steps to get up'n'running with Rails on OS X

6 steps to set up a rails development environment on OS X:

  • install Apple Command Line Tools
  • install homebrew[1]: /usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
  • install rvm: bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
  • install ruby rvm install 1.9.3
  • install rails gem i rails
  • start a project rails new myproject

[1] Use brew command to install whatever database engine you need, ie brew install sqlite

@myabc
Copy link

myabc commented Mar 29, 2012

OS X GCC Installer can be considered deprecated in favour of Command Line Tools for Xcode

@solnic
Copy link
Author

solnic commented Mar 29, 2012

@myabc right! I forgot about that

@mig-hub
Copy link

mig-hub commented Mar 29, 2012

Can't hurt to install the developer tools from the MacOSX DVD instead.
Especially if the purpose is to get up-and-running quickly for a newbie.
No?

@mrcasals
Copy link

If you managed a way to install the .pkg file from OS X GCC Installer, then you can make a beautiful one-liner for this... ;)

That'd be quite cheap, actually :P

@stevenringo
Copy link

@mig-hub Those have been deprecated in favour of the GUI version on the app store and the command line tools as above.

@mig-hub
Copy link

mig-hub commented Mar 29, 2012

Sorry I forgot that there is no DVD anymore.
Mine is one of the last one to have a DVD because it's snow leopard.
We have a lion as well here and I had to use the AppStore (beurk...)

@napcs
Copy link

napcs commented Mar 29, 2012

I could be wrong, but I believe the command line tools Apple provides work on 10.7.3 only and have problems compiling other versions of Ruby. And to get those tools you have to get a developer account and get stuff. Minor annoyance but an annoyance nonetheless.

And honestly, even this is too much. Since we Rails folks are all about the automation, why does this need 8 steps? Why not one? In fact I think there are some scripts in the rvm repo that get this started :)

@rwilcox
Copy link

rwilcox commented Mar 29, 2012

It should be that simple, but there's a ton of stuff that can go wrong. I explain with a 20 step trail of tears story...

@pixeltrix
Copy link

@rwilcox similar story here - I need to be able to compile software that used the Mac SDK so couldn't use the OS X GCC package. Using the new Apple Command Line Tools package failed because the llvm-gcc compiler doesn't work with legacy versions of ruby like REE which I needed for existing sites. It took the best part of two days to work out that I needed to install XCode 4.1 and then XCode 4.3 - which is 4GB of downloading. Then there's the time that all that compiling takes - I want to see a Rails.app that allows you to install pre-built binaries of dependencies like webservers, databases, gems, etc. It's the 21st century, we don't need to compile stuff.

@solnic
Copy link
Author

solnic commented Mar 29, 2012

Please note that we are talking about getting up and running rather than discussing if using xcode vs gcc-installer vs command line tools is good or not in the long term. When you start you just want to install the latest version of ruby and rails and you're done.

@pixeltrix
Copy link

Whilst ruby-1.9.3p125 will compile using llvm-gcc, there are plenty of common gems that rely on third party libraries that wont. Also the description for Rails.app talks about it being used by experienced developers - it's not intended to be just a mac version of railsinstaller.org.

@masterkain
Copy link

Does rvm install alone take care of switching to the new interpreter and set it up as default? You might want to add an extra step :)

@mpapis
Copy link

mpapis commented Mar 29, 2012

@masterkain it does in rvm get head ... actually I was considering adding flags --ruby[=1.9.3] --gems=rails so you could go with 4 steps

@mig-hub
Copy link

mig-hub commented Mar 29, 2012

The all thing is more about Ruby than Rails anyway.
So it could be worth having a Ruby.app instead of a Rails.app
I wouldn't use either but that still make sense.

@mig-hub
Copy link

mig-hub commented Mar 29, 2012

What we need is a RailsOS that could boot from a USB stick.
So that you've got really everything you need and we all have the same.
No problem with Winshit or Macinpoo anymore.
Just a thought.

@adrianpacala
Copy link

@mig-hub please spare us any more of your thoughts.

@mpapis
Copy link

mpapis commented Mar 30, 2012

@solnic now you can do it in 1 (One) step: https://gist.github.com/2246595

@mig-hub
Copy link

mig-hub commented Mar 30, 2012

@adrpac

First of all, I don't think programming should prevent one from having a sense of humour. And second because the things I've said are only half jokes.

In fact I even like this topic a lot because it refers to problems I have everyday at work.
The problem of choosing between monolithic and modular.
Both have pros and cons and it is difficult to make a good choice.
Because the more something is modular (the path I usually take most of the time), and the more you have to deal with versions and dependency.
Which could lead to a nightmare and sometimes defeat the point of simplicity.
And in that respect, I don't think this is a Rails specific problem.

Now I think Katz is a very clever and respected programmer.
Presumably better than most of us (I would assume).
And also recognise the problem of having a Ruby environment installed (not Rails in particular) for building web-applications.
I currently have an intern here at the studio to who I have to teach these things and while I am doing/explaining it, I feel there is a shortcut missing somewhere.

Nevertheless I still find the project somewhat useless especially because one of the purpose is to fit a newbie AND a regular user.
Just because I used Locomotive myself a while ago, I liked it but then when I became more interested and skilled I felt the gate it was between me and ruby and the rest of my machine.
But it is a nice way to discover the thing in a painless way and for that, a simple sandbox will do the job and would cost less.

Now even for newbies I sort of feel that Rails already does too much magic that prevents users from knowing what they are doing.
It brings bad habits and misconceptions, so I wouldn't like that to happen to the install side as well.
And here it is not necessarily a valuable argument that people could share, more like a feeling, but we are made of feelings and our choices are often based on them, aren't they?

Now I'm sure the purpose is to get the best of monolithic and modular, otherwise it would be pointless.
And this is just something I can't manage to believe in.
Maybe I'm a bit too extreme, but I don't.

Hence the joke about RailsOS.
This is still a joke but if somebody would do that, I would not find that ridiculous.
Or no more ridiculous than a Rails.app

After all, the purpose of a monolithic version is to fit one problem and fit it very well.
So considering the fact that majority of people will deploy on Heroku, one could easily offer a Linux distro that mimics exactly what you have on Heroku plus everything else you need like text editors and stuff.
You start it from a USB stick, if you dislike it, then you never boot it again.
After all, the all thing about Rails (you like it or not) is convention over configuration and hiding complexity by choosing the best option possible for the developer and then hide it.
And there is nothing wrong with this.

Now nothing in there is a truth, these are just my thoughts.
And I would be very pleased if Rails.app goes out and make the happiness of many people.

Also I would like to apologise @adrpac (maybe others) if my irony made you feel uncomfortable.
I don't want to turn Github into a silly ranting blog either.

Have a nice day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment