Skip to content

Instantly share code, notes, and snippets.

@KellyLSB
Last active January 1, 2016 18:58
Show Gist options
  • Save KellyLSB/8186835 to your computer and use it in GitHub Desktop.
Save KellyLSB/8186835 to your computer and use it in GitHub Desktop.
export CFLAGS="-std=c++11 $CFLAGS"
export CFLAGS="-stdlib=libc++ $CFLAGS"
export CC="clang++"
alias clang++11="clang++ -std=c++11"

Build SQL From Source Mac (Using mysql-5.6.15 on OSX 10.9.1)

1. Download the Generic Linux (Architecture Independent) Tar from (http://dev.mysql.com/downloads/mysql/)
2. Uncompress the archive `tar -xvf ~/Downloads/mysql-5.6.15.tar.gz`
3. Create a new build folder `mkdir -p ~/build/mysql`
4. Enter build folder `cd ~/build/mysql`
5. Run Cmake `cmake ~/Downloads/mysql-5.6.15`
6. Allow source downloads `cmake . -DENABLE_DOWNLOADS=1`
7. Patch ~/Downloads/mysql-5.6.15/source/source_downloads/gmock-1.6.0/gtest/include/gtest/internal/gtest-port.h`
    - Around line 459 ensure that all variables of `GTEST_USE_OWN_TR1_TUPLE` are set to '1'
8. Patch `~/Downloads/mysql-5.6.15/unittest/gunit/stdcxx-t.cc`
    - Around line 21 change to `#include <unordered_map>`
    - Around line 35 change to `  typedef std::unordered_map<K, T> Type;
9. Add the following to your bash/zsh/sh profile (https://gist.github.com/KellyLSB/8186835/raw/5f1b7d764f5a7bf4050ede2040094a30e8464203/.profile)
11. Run cmake in your build dir `cmake .` (include the period)
10. Run make in your build dir `make`
11. Run make install `make install`
12. Enter the MySQL Director `cd /usr/local/mysql`
13. Run `script/mysql_install_db`
14. Download (https://gist.github.com/KellyLSB/8186835/raw/2bdde6b56a217f90b231e5f7a9ff3624666c1f6c/mysql.from.source.plist) to `~/Library/LaunchAgents/mysql.from.source.plist`
15. Symlink `/usr/local/mysql/lib/libmysqlclient.18.dylib` to `/usr/local/lib`
16. Add `/usr/local/mysql/bin` to your $PATH
17. Enter your Jiff3 project directory
18. Remove mysql2 gem `gem uninstall mysql2` (Remove All)
19. Set bundler to use the new mysql path: `bundle config build.mysql2 --with-mysql-config=/usr/local/mysql/bin/mysql_config
20. Bundle install
21. Profit?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>mysql.from.source</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/mysql/bin/mysqld_safe</string>
<string>--bind-address=127.0.0.1</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>/usr/local/mysql/data</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment