正文开始前默认已安装Homebrew,没有安装的可以移步Homebrew的安装
一、二进制安装
执行以下命令,会一并为你安装mysql和sysbench
# Add --with-postgresql if you need PostgreSQL support
brew install sysbench
二、源码编译安装
1.下载源码,github地址:https://github.com/akopytov/sysbench
git clone git@github.com:akopytov/sysbench.git
2.依次执行以下命令
brew install automake libtool openssl pkg-config
# 如果已经有mysql,忽略这一步
brew install mysql
# 不需要PostgreSQL的,忽略这一步
brew install postgresql
# 添加环境变量,避免出现"ld: library not found for -lssl"
export LDFLAGS=-L/usr/local/opt/openssl/lib
3.切换到sysben