Skip to content

Instantly share code, notes, and snippets.

@labeneator
Created October 4, 2013 21:49
Show Gist options
  • Select an option

  • Save labeneator/6833376 to your computer and use it in GitHub Desktop.

Select an option

Save labeneator/6833376 to your computer and use it in GitHub Desktop.

Revisions

  1. labeneator created this gist Oct 4, 2013.
    34 changes: 34 additions & 0 deletions RMySQL_works.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    # Find your R home

    $ echo "R.home()" | Rscript /dev/stdin
    Loading required package: stats
    Loading required package: methods
    [1] "/usr/local/Cellar/r/3.0.1/R.framework/Resources"


    # Make sure that you have the MySQL home var in your Renviron

    $ fgrep MYSQL_HOME /usr/local/Cellar/r/3.0.1/R.framework/Resources/etc/Renviron
    MYSQL_HOME="/usr/local/mysql-5.6.12-osx10.7-x86_64/"

    #### This step trips up everyone ####
    # Make sure that the libmysqlclient dynamic lib is in your R lib path by

    # 1. Get the dll path
    $ echo "Sys.getenv('DYLD_FALLBACK_LIBRARY_PATH')" | Rscript /dev/stdin
    Loading required package: stats
    Loading required package: methods
    [1] "/usr/local/Cellar/r/3.0.1/R.framework/Resources/lib"

    # 2. Symlink your libmysqlclient
    $ ln -s /usr/local/mysql-5.6.12-osx10.7-x86_64/lib/libmysqlclient.18.dylib /usr/local/Cellar/r/3.0.1/R.framework/Resources/lib

    # 3. Install the package
    $ export PKG_LIBS="-L/usr/local/mysql-5.6.12-osx10.7-x86_64/lib/ -lmysqlclient"
    $ export PKG_CPPFLAGS="-I/usr/local/mysql-5.6.12-osx10.7-x86_64/include/"
    $ R CMD INSTALL RMySQL.tar.gz
    ...
    ...
    ** installing vignettes
    ** testing if installed package can be loaded
    * DONE (RMySQL)