Skip to content

Instantly share code, notes, and snippets.

@mhayes
Created December 4, 2012 18:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhayes/4207399 to your computer and use it in GitHub Desktop.
Save mhayes/4207399 to your computer and use it in GitHub Desktop.
Mountain Lion + rbenv + mysql2
export PATH="$HOME/.rbenv/bin:$PATH:/usr/local/mysql/bin"
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib
eval "$(rbenv init -)"

Overview

Steps to get MySQL2 up and running on Mountain Lion:

The basics

  1. Install Homebrew
  2. Install rbenv + ruby-build
  3. Install 1.9.3-p286 using rbenv install 1.9.3-p286
  4. Install mysql from here.

The error

Running gem install mysql2 results in the following error:

Library not loaded: libmysqlclient.18.dylib

The fix

Edit your ~/.bash_profile so that it looks like:

export PATH="$HOME/.rbenv/bin:$PATH:/usr/local/mysql/bin"
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib
eval "$(rbenv init -)"

External resources

The following links helped me figure this out:

StackOverflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment