Warning: This content was posted a while ago and may be incorrect by now. Please search for more recent guidance with your preferred search engine.
Moving in a new direction, I’ve taken up a position as a Rails developer and am documenting the setup process on OS X as the tutorials out there once again felt a bit lacking – leaving out some crucial bits.
I’ll be developing on Ubuntu at work (which had a much easier setup), but I like to play around on my iMac at home and thus need to have Rails running on there as well.
Don’t even bother with RVM on OS X – it did just enough damage to have me almost having to reinstall Homebrew.
OK, let’s get started.
For the most part you can follow the instructions at Go Rails, but install Ruby 2.2.4 instead of version 2.2.3. Similarly with Rails, if you’re just starting out, you might as well start with version 5.0.0 instead of version 4.2.4.
I’ve decided to go with PostgreSQL instead of MySQL for Rails as that’s what the majority of the tutorials I found seem to recommend. The install instructions from Go Rails are good, but to actually create a user, database, etc. on OS X use the instructions below.
myapp with whatever your Rails app is actually named.
Add a user for your Rails app in the terminal with
$ createuser myapp -s.
Connect to PostgreSQL with
$ sudo psql -U $(whoami) postgres.
$(whoami) can be replaced by your actual username or simply used as-is as it will insert your username where it’s specified.
Once the user has been created, change its password with
postgres=# password myapp.
Create the database for your app with
postgres=# CREATE DATABASE myapp_development.
Then simply exit
Go ahead and start building your first Rails app!