Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tree: 34c0484368
Fetching contributors…

Cannot retrieve contributors at this time

157 lines (127 sloc) 5.297 kB
require 'formula'
class PerconaServer < Formula
homepage ''
url ''
version '5.5.27-28.1'
sha1 '78bd7b408847003eb755efef646ff85ccfa071d0'
depends_on 'cmake' => :build
depends_on 'readline'
depends_on 'pidof'
option :universal
option 'with-tests', 'Build with unit tests'
option 'with-embedded', 'Build the embedded server'
option 'with-libedit', 'Compile with editline wrapper instead of readline'
option 'enable-local-infile', 'Build with local infile loading support'
conflicts_with 'mysql',
:because => "percona-server and mysql install the same binaries."
conflicts_with 'mariadb',
:because => "percona-server and mariadb install the same binaries."
fails_with :llvm do
build 2334
cause ""
def install
# Build without compiler or CPU specific optimization flags to facilitate
# compilation of gems and other software that queries `mysql-config`.
# Make sure the var/msql directory exists
args = std_cmake_args + [
# CMake prepends prefix, so use share.basename
# PAM plugin is Linux-only at the moment
# To enable unit testing at build, we need to download the unit testing suite
if build.include? 'with-tests'
# Build the embedded server
args << "-DWITH_EMBEDDED_SERVER=ON" if build.include? 'with-embedded'
# Compile with readline unless libedit is explicitly chosen
args << "-DWITH_READLINE=yes" unless build.include? 'with-libedit'
# Make universal for binding to universal applications
args << "-DCMAKE_OSX_ARCHITECTURES='i386;x86_64'" if build.universal?
# Build with local infile loading support
args << "-DENABLED_LOCAL_INFILE=1" if build.include? 'enable-local-infile'
system "cmake", *args
system "make"
system "make install"
# Don't create databases inside of the prefix!
# See:
rm_rf prefix+'data'
# Link the setup script into bin
ln_s prefix+'scripts/mysql_install_db', bin+'mysql_install_db'
# Fix up the control script and link into bin
inreplace "#{prefix}/support-files/mysql.server" do |s|
s.gsub!(/^(PATH=".*)(")/, "\\1:#{HOMEBREW_PREFIX}/bin\\2")
ln_s "#{prefix}/support-files/mysql.server", bin
def caveats; <<-EOS.undent
Set up databases to run AS YOUR USER ACCOUNT with:
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix percona-server)" --datadir=#{var}/percona --tmpdir=/tmp
To set up base tables in another folder, or use a different user to run
mysqld, view the help for mysqld_install_db:
mysql_install_db --help
and view the MySQL documentation:
To run as, for instance, user "mysql", you may need to `sudo`:
sudo mysql_install_db ...options...
Start mysqld manually with:
mysql.server start
Note: if this fails, you probably forgot to run the first two steps up above
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
To connect:
mysql -uroot
To launch on startup:
* if this is your first install:
mkdir -p ~/Library/LaunchAgents
cp #{plist_path} ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
* if this is an upgrade and you already have the #{plist_path.basename} loaded:
launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename}
cp #{plist_path} ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
You may also need to edit the plist to use the correct "UserName".
def startup_plist; <<-EOPLIST.undent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
Jump to Line
Something went wrong with that request. Please try again.