libmysqlclient15-dev on macs?

前端 未结 6 679
名媛妹妹
名媛妹妹 2020-12-01 13:35

Does OSX need an install of libmysqlclient15-dev? I\'m trying to compile a gem that is failing and a lot of sources says to install \"libmysqlclient15-dev\" but I only see t

相关标签:
6条回答
  • 2020-12-01 14:27

    Yes you will need to install this. For example if you are trying to install the mysql gem you will need the headers for the mysql library. This is because some gems need to compile native extensions, so they need the header files for any 3rd party libraries that the extensions uses.

    On Mac OS X I recommend using MacPorts to manage the installation of these libraries/headers.

    0 讨论(0)
  • 2020-12-01 14:28

    brew install mysql fixed this for me

    0 讨论(0)
  • 2020-12-01 14:30

    I know this is old, but google got me here. So let's say the solution in 2018 for python3 on OSX.

    brew install mysql-client echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile source ~/.bash_profile pip install mysqlclient

    0 讨论(0)
  • 2020-12-01 14:34

    Those instructions are for Debian type Linuxes. The closest thing to Debian for OS X is Fink. After getting that installed and set up, you can say fink install mysql-unified-dev to get essentially the same thing as asking for libmysqlclient15-dev on a Debian or Ubuntu type system.

    Beware that Fink installs its packages in /sw, and not all build scripts know to look there for libraries and headers. You might have to give custom build options to get it to figure this out.

    A path that may be more successful is to simply download the MySQL 5.0 package for Mac OS X. That should include the same development files as libmysqlclient15-dev, and as a bonus will put them in places more likely to be found by your gem.

    (Why 5.0, by the way? Because that's what corresponds to ABI version 15, which your package apparently requires. Maybe it will in fact work with 5.1, or 5.4, or 6.0, but that would be a risk you'd have to decide to take on your own.)

    0 讨论(0)
  • 2020-12-01 14:36

    If you are using the mysql dmg file to install mysql you will need to edit your ~/.bash_profile and include this:

    export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
    
    0 讨论(0)
  • 2020-12-01 14:39

    I just had the same problem and only got a partial working solution. Here are the steps I made to make it work:

    • brew install mysql-client
    • brew install mysql-connector-c

      IF YOU HAVE ZSH:

    • echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.zshrc

    • source ~/.zshrc

      ELSE:

    • echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile

    • source ~/.bash_profile

      Now for the installation itself:

    • LDFLAGS=-L< your openssl lib folder location > pip install mysqlclient==< version >

      for example: LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient==1.3.12

    0 讨论(0)
提交回复
热议问题