Build on macOS
Instructions for building Vitess on your machine for testing and development purposes
<< Build on CentOS Build on Ubuntu/Debian >>
If you run into issues or have questions, we recommend posting in our Slack channel, click the Slack icon in the top right to join. This is a very active community forum and a great place to interact with other users.
The following has been verified to work on macOS Mojave. If you are new to Vitess, it is recommended to start with the local install guide instead.
Install Dependencies
Install Xcode
Install Homebrew and Dependencies
Install Homebrew. From here you should be able to install:
brew install go@1.15 automake git curl wget mysql@5.7
Add mysql@5.7
and go@1.15
to your PATH
:
echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/go@1.15/bin:$PATH"' >> ~/.bash_profile
Do not install etcd via brew otherwise it will not be the version that is supported. Let it be installed when running make build.
Do not set up MySQL or etcd to restart at login.
Build Vitess
Navigate to the directory where you want to download the Vitess source code and clone the Vitess GitHub repo:
cd ~
git clone https://github.com/vitessio/vitess.git
cd vitess
Set environment variables that Vitess will require. It is recommended to put these in your ~/.bash_profile
file:
# Vitess binaries
export PATH=~/vitess/bin:${PATH}
Build Vitess:
make build
Testing your Binaries
The unit tests require that you first install a Java runtime. This is required for running ZooKeeper tests:
brew tap adoptopenjdk/openjdk
brew install adoptopenjdk8
brew info java
You will also need to install ant
and maven
:
brew install ant maven
You can then install additional components from make tools
. If your machine requires a proxy to access the Internet, you will need to set the usual environment variables (e.g. http_proxy
, https_proxy
, no_proxy
) first:
make tools
make unit_test
In addition to running tests, you can try running the local example.
Common Build Issues
Key Already Exists
This error is because etcd was not cleaned up from the previous run of the example. You can manually fix this by running ./401_teardown.sh
, removing vtdataroot and then starting again:
Error: 105: Key already exists (/vitess/zone1) [6]
Error: 105: Key already exists (/vitess/global) [6]
/tmp/mysql.sock Already In Use
This error occurs because mysql is serving on the same port that vttgate requires. To solve this issue stop mysql service. If you have installed mysql via brew as specified above you should run:
brew services stop mysql@5.7