我在苹果M1 mac os 12.1我已经成功安装mysql2与命令
gem install mysql2 -v '0.5.3' -- \
--with-mysql-lib=/opt/homebrew/Cellar/mysql/8.0.28/lib \
--with-mysql-dir=/opt/homebrew/Cellar/mysql/8.0.28 \
--with-mysql-config=/opt/homebrew/Cellar/mysql/8.0.28/bin/mysql_config \
--with-mysql-include=/opt/homebrew/Cellar/mysql/8.0.28/include
Successfully installed mysql2-0.5.3
Parsing documentation for mysql2-0.5.3
Done installing documentation for mysql2 after 0 seconds
1 gem installed
当运行bundle install
时,我仍然得到错误
linking shared-object mysql2/mysql2.bundle
ld: warning: directory not found for option '-L/opt/homebrew/Cellar/mysql/8.0.28/lib --with-mysql-dir=/opt/homebrew/Cellar/mysql/8.0.28
--with-mysql-config=/opt/homebrew/Cellar/mysql/8.0.28/bin/mysql_config --with-mysql-include=/opt/homebrew/Cellar/mysql/8.0.28/include'
ld: library not found for -lzstd
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mysql2.bundle] Error 1
安装mysql2(0.5.3)时出错,Bundler无法继续。在绑定之前确保gem install mysql2 -v '0.5.3'
成功。
3条答案
按热度按时间wribegjk1#
安装如下:
或
1u4esq0p2#
运行此命令:-
$ sudo apt-get install default-libmysqlclient-dev
pcrecxhr3#
我在M1 mac上也遇到了同样的错误,并尝试了下面的命令。
GitHub