Cory Dorning

code hard. code strong.

Setting Up Octopress on Mac OS X

| Comments

After a few trie on my MacBook Air and my iMac, I finally got Octopress setup without a hitch. After running into a few hurdles along the way, I found myself hitting the Google several times, trying to resolve individual issues. For my own personal, future reference, and to help others that may have similar issues, I decided to go ahead and write-up a step by step guide.

If you are pretty savvy with the command line, have a deep understanding of the Mac platform, know the basics of Git and are a someone who tinkers with Ruby, then the Octopress Setup guide is probably all you’d need. For those that don’t fit this criteria, read on.

Step 1: Making Sure Xcode is Setup

Follow the steps based on the version ov OS X you are using. As far as I know, if you don’t remember installing it, you probably don’t have it installed yet. You can do a quick search for it using Spotlight. If you do have it installed, be sure to check the Xcode version you are running and check to see if it meets the criteria for your OS below.

Snow Leopard

For Snow Leopard you need to make sure you have Xcode Tools Version 3.2.1 (1613) or later.

If you don’t have it installed, your best bet is to download it from the latest Xcode Tools from Apple’s Website. The reason for doing this is because the Snow Leopard DVD install of Xcode contains bugs.

Lion

If you’re running Lion, your best bet is to use Xcode Tools Version 4.1 or later. Simply open up the Mac App Store and search for Xcode. Download it and then wait (it takes awhile). Once it is finished you will need to open the download, since that is what actually triggers the install.

Step 2: Install and Configure Git

Download the Mac OS X version of Git and install it.

Once it’s installed, open up a Terminal window and run the following commands:

git config --global user.name "your name here"
git config --global user.email your-email-address-here

If you receive git: command not found, you will have to add the git directory to your PATH variables:

echo 'export PATH=/usr/local/git/bin:$PATH' >> ~/.profile

Restart Terminal and then enter:

echo $PATH

You should see that the git directory was appended to the PATH. (Source)

Step 3: Install and Configure RVM

In a Terminal window run the following command, which will install the latest version of Ruby Version Manager (requires Git):

bash \< \<(curl -s https://rvm.beginrescueend.com/install/rvm)

If you were paying attention, you probably noticed this when it was complete:

You must now complete the install by loading RVM in new shells.

If you wish to use RVM in an interactive fashion in your shells then Place the following line at the end of your shell’s loading files (.bashrc or .bash_profile for bash and .zshrc for zsh), after all PATH/variable settings:

[[ -s "/Users/corydorning/.rvm/scripts/rvm" ]] && source "/Users/corydorning/.rvm/scripts/rvm"

You only need to add this line the first time you install RVM.

NOTE: After doing some research on the difference between .bashrc and .bash_profile I decided to use .bash_profile.

Open up / create a new .bash_profile (I use nano):

sudo nano ~/.bash_profile

At the very end, add the following:

# Should be at the end of the file
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

After saving it, reload your bash profile:

. ~/.bash_profile

Step 4: Install Ruby and Set Default Version

To install Ruby version 1.9.2 and set it as the default version, open a Terminal window and use RVM:

rvm install 1.9.2 && rvm use 1.9.2

If you have issues compiling, edit your .bash_profile:

sudo nano ~/.bash_profile

Add this to it (before the RVM lines works): (source)

export CC=/usr/bin/gcc-4.2

NOTE: This is not something I had to do.

Step 5: Check Your Version of Ruby

Now we want to make sure everything is in order to this point. To do so, check to make sure you are on Ruby 1.9.2. Open a Terminal window and run:

ruby --version

Step 6: Clone Octopress

Almost there…time to grab Octopress. In a Terminal window, change to the directory where you want the files to be pulled down into (preferably your web root):

cd /webserver/root

Now use git to clone Octopress (change sitename to whatever you want the folder to be called):

git clone git://github.com/imathis/octopress.git sitename

Change directory to the folder you just cloned Octopress to: cd sitename

NOTE: You will be asked if you trust the .rvmrc file, just say yes.

Step 7: Install Dependencies

Install the necessary dependencies for Octopress:

gem install bundler

followed by:

bundle install

NOTE: If you want the default Octopress theme (recommende), run the following also:

rake install

Step 8: Next Steps

Congrats! You’re finished…Octopress should be ready for you to use. Head on over to the Octopress website to Setup Deployment, Configure Your Blog, or to Start Blogging.1

Comments