Building Retrosheet Database on a Mac –
Okay, this post is going to be a long one, but by the end of it, you will have created yourself a Retrosheet database for MySQL or MariaDB. There is a post similar to this on Beyond the Boxscore called Saberizing a Mac #9: Retrosheet (part1); however, it is severely lacking details on how to get the database actually set up your Mac.
Installing Homebrew
In order to parse the .EVN and .EVA event files from Retrosheet, we need to install the Chadwick tools. Before we can do that we need to install Homebrew which is a package manager for OSX.
Download XCode for Mac
You can install XCode directly from the Mac App Store. We need this to install the command-line tools.
Get the Command-Line Tools
Open up your terminal which is located in /Applications/Utilities/
, and in
the terminal run the following command.
Install Homebrew
Now that we have the command-line tools, we can finally download and install Homebrew. Keep your terminal app open and run:
Once, it is installed run brew doctor
and if you get the message
Your system is ready to brew
you are golden. If you do not, this
post
is an excellent troubleshooting resource.
Install MariaDB
If you already have MySQL or MariaDB installed on your computer, you can skip this section and move onto installing Chadwick. Once we have homebrew installed we can build MariaDB which is a fork of MySQL that has better performance. Reasons for choosing MariaDB over MySQL can be found here. To install we run:
Once that is completed run:
You can make it so every time you log in to your computer the MariaDB/MySQL server starts up, but I prefer to start it manually any time I need it. To start it all you have to do is run in your terminal.
Once you start up the server, you logging in is very easy.
Install Chadwick
A couple weeks ago I was finally able to get Chadwick added to Homebrew. This makes installing the it so much easier on a Mac.
Chadwick is an open-source program that allows one to parse the event files from Retrosheet. Suppose I have the event files from the 2014 season, which can be downloaded directly from Retrosheet. I then unzip the files and navigate into the directory in which it was unzipped.