Skip to content

Instantly share code, notes, and snippets.

@ambethia
Created February 3, 2010 17:31
Show Gist options
  • Save ambethia/293808 to your computer and use it in GitHub Desktop.
Save ambethia/293808 to your computer and use it in GitHub Desktop.
Rails Dev Stack on Snow Leopard

Rails Dev Stack on Snow Leopard

(from a scratch install). Kinda, I imported my user home (~) from a Time Machine backup.

Homebrew

sudo mkdir /usr/local
sudo chown -R `whoami` /usr/local
curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local

I've already got /usr/local in my PATH.

Now, so we can easily update homebrew later:

brew install git

cd /usr/local
git init
git remote add origin git://github.com/mxcl/homebrew.git

RubyGems

mate ~/.bash_profile
export GEM_HOME="$(brew --prefix)/Cellar/Gems/1.9"
export GEM_PATH="$(brew --prefix)/Cellar/Gems/1.9"
gem install brewbygems
gem update --system

The gem update throws an error:

ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied - /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/gem

But it seems to have still updated okay.

gem install rails

Passenger

gem install passenger
passenger-install-apache2-module

mate ~/sbin/passenger-ruby
#!/bin/bash
export GEM_PATH=/usr/local/Cellar/Gems/1.8:/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/lib/ruby/gems/1.8/gems
export GEM_HOME=/usr/local/Cellar/Gems/1.8

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby $*
chmod +x sbin/passenger-ruby

mate /etc/apache2/users/jasper.conf
LoadModule passenger_module /usr/local/Cellar/Gems/1.8/gems/passenger-2.2.10/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/Cellar/Gems/1.8/gems/passenger-2.2.10
PassengerRuby /Users/jasper/sbin/passenger-ruby

RailsEnv development
sudo apachectl -k restart

Install Passenger.prefPane http://github.com/alloy/passengerpane

MySQL

brew install mysql

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

cp /usr/local/Cellar/mysql/5.1.43/com.mysql.mysqld.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/com.mysql.mysqld.plist

mysql_install_db
# mysql_secure_installation

launchctl start com.mysql.mysqld

Rails Dev Stack on Snow Leopard

(from a scratch install). Kinda, I imported my user home (~) from a Time Machine backup.

Homebrew

sudo mkdir /usr/local
sudo chown -R `whoami` /usr/local
curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local

I've already got /usr/local in my PATH.

Now, so we can easily update homebrew later:

brew install git

cd /usr/local
git init
git remote add origin git://github.com/mxcl/homebrew.git
git pull origin master

Sanity check:

brew update

Ruby & Gems

brew install ruby

mate ~/.bash_profile
export GEM_HOME="$(brew --prefix)/Cellar/Gems/1.9"
export GEM_PATH="$(brew --prefix)/Cellar/Gems/1.9"

Start a new terminal session.

gem update --system
gem install brewbygems 

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

Passenger

gem install passenger
passenger-install-apache2-module

mate /etc/apache2/users/jasper.conf
LoadModule passenger_module /usr/local/Cellar/Gems/1.9/gems/passenger-2.2.10/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/Cellar/Gems/1.9/gems/passenger-2.2.10
PassengerRuby /usr/local/Cellar/ruby/1.9.1-p378/bin/ruby
RailsEnv development
sudo apachectl -k restart

Install Passenger.prefPane http://github.com/alloy/passengerpane

MySQL

brew install mysql

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

cp /usr/local/Cellar/mysql/5.1.43/com.mysql.mysqld.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/com.mysql.mysqld.plist

mysql_install_db
# mysql_secure_installation

launchctl start com.mysql.mysqld
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment