Skip to content

Instantly share code, notes, and snippets.

@joshkraemer
Last active October 4, 2015 23:57
Show Gist options
  • Save joshkraemer/2719249 to your computer and use it in GitHub Desktop.
Save joshkraemer/2719249 to your computer and use it in GitHub Desktop.
MySQL and MAMP Installation
Here are the steps on how to get MySQL working with MAMP and Rails Projects:
Note: If you already have MAMP installed and you update the mysql2 gem, you'll need to run steps 4-6 to change the gem version that is linked to MAMP.
1.) Download and install MAMP (if it's not already installed) - http://www.mamp.info/downloads/releases/MAMP_PRO.zip
2.) Add these lines to your .bash_profile file. Be sure to remove any existing lines that reference MAMP.
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
export PATH="/Applications/MAMP/Library/bin:$PATH"
export PATH="/Applications/MAMP/bin/php/php5.2.17/bin/:$PATH"
export PATH="/Applications/MAMP/bin/php/php5.3.6/bin/:$PATH"
Make sure that the above ^^ paths are correct.
3.) Download and install the MySQL package - http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.13-osx10.7-x86_64.dmg/from/http://cdn.mysql.com/
4.) Switch to the global gemset: "rvm use 1.9.3@global"
5.) Run "gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config"
6.) Run "sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib ~/.rvm/gems/ruby-1.9.3-p125@global/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle"
Note: Find the correct path to the gem by running "bundle show mysql2"
--------------------------------
Kill running mysql processes
kill -9 `ps aux | grep mysql | grep -v grep | awk '{print $2}'`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment