Thursday, November 11, 2010

Installing Rails 3 on OSX

Most see this link. However, lets's skip the rvm stuff:

sudo gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
sudo gem install rails

which gave me this message

File not found: lib

The answer was here:

cd /Library/Ruby/Gems/1.8/gems/rails-3.0.1
mkdir lib

Also, I should mention that I never knew that 

gem server

is the answer to all documentation on Ruby (thanks Sean). Another good answer is railsapi.com, including the 2.3.8 documentation and the 3.0.1 documentation.

I'll have to run through a Rails 3 book soon, I see, mostly to learn the stuff I should've known even in Rails 2.

Note: After writing this it turns out that I still couldn't connect to MySql from XAMPP on my OSX box. I ended up using this command

env ARCHFLAGS="-arch x86_64" sudo gem install mysql -- --with-mysql config=/usr/local/mysql/bin/mysql_config 

but I have no idea why I have a mysql_config there. Perhaps it's from an earlier botched install of MySql? If all of this doesn't work, you can always run through the real MySql directions here.

From there, there was a simple two-step process:

1. Add

gem 'mysql'  

to the gemfile.

2. Change the development section of the database.yml to say


development:
  adapter: mysql
  encoding: utf8
  database: test-rails3
  username: root
  password: 512ilwae2iwo
  host: localhost
  socket: /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock

subbing the appropriate values as necessary. 

Then use rails server and you're up and running.

No comments: