Jan 7 2011

Fresh Ruby & Rails Install on Snow Leopard

Download and Install XCode

XCode takes a while to download so we might as well start with this. You can continue on to the next steps while it downloads… until you run into a step that requires XCode

Download and Install MySQL

I’ve built mysql several times and haven’t find an advantage over installing it from the official DMG source. Installing it from the DMG is much easier and has a higher degree of success.

Just Google for “MySQL mac download”. It should take you to the MySQL download page. Download the 64-bit DMG and do the standard thing. Open it up and run the mysql install. Also add the System Preferences to make starting and stopping the MySQL service easier.

Update your Gems Environment

gem -v
gem environment
sudo gem update --system
sudo gem update
gem list --local

You might want to install hanna also. It’s an alternate rdoc template. I have it my system configured to automatically use hanna when generating rdoc.

sudo gem install hanna

Install Homebrew for your Unix Package Needs.

Homebrew is a nice simple package manager for OS X. Some alternatives are ports and fink. I’ve used them both before and prefer ports over fink.

ruby -e "$(curl -fsSL https://gist.github.com/raw/323731/install_homebrew.rb)"
brew

Once you install homebrew, you can easily install other packages. Ack “is a tool like grep, designed for programmers with large trees of heterogeneous source code.” Bash Completion helps make the bash command line easier to use. It’ll allow you to tab fill your ssh locations for example.

brew install git
brew install ack
brew install bash-completion

Install rvm

Here’s where we start adding some real meat to your system. rvm is not strictly necessary but highly recommanded.


# Install rvm
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
# set up rvm in .profile... or use rubyconsumer's dotfiles setup. (see below)
# To seamlessly abandon the Apple-installed system ruby (ruby 1.8.7 patchlevel 174 for Snow Leopard):
rvm install 1.8.7 # installs patch 302: closest supported version
rvm system ; rvm gemset export system.gems ; rvm 1.8.7 ; rvm gemset import system # migrate your gems
rvm --default 1.8.7

Set up Dotfiles

I have my dotfiles saved on github. I suggest either 1) look through and picking up what you need, 2) fork it, use it as is and start making your own additions. I've tried to keep it commented.

I place my configs into dropbox and symlink to them.


cd ~/Dropbox/wtsang

Clone or fork and clone dotfiles


git clone git@github.com:rubyconsumer/dotfiles.git

Set up dotfiles.


cd dotfiles
setup

My dotfiles project has a setup script which will non-destructively symlink to dotfiles. You'll need to modify it to work for you, until I make the appropriate changes since it's hardcoded to my Dropbox location.

Install Editor

Textmate is an obvious choice. If you are going to use vi, check out mac vim and carlhuda's Janus.


for i in ~/.vim ~/.vimrc ~/.gvimrc; do [ -e $i ] && mv $i $i.old; done
git clone git://github.com/carlhuda/janus.git ~/.vim
cd ~/.vim
rake


Jul 2 2008

Faster Gem Docs

A few weekends ago, I was at Ann Arbor Startup Weekend. It was a great weekend. We had a functional alpha/beta at the end of the weekend. This was despite the, to put it mildly, congested wifi.

A lot of folks are very reliant on the internet for information. Understandably so, but it doesn’t work in a weak and no wifi situation.

Using gem_server to get your documentation each time seems like a lot of work.

Enter Bashfully Yours, Gem Shortcuts.

By setting up my bash to load up gem documentation, I’m able to get documentation faster then you can off the web.

gemdoc hpricot

Done!

Try it out. It might even inspire you to help out with documenting a few gems.