It's often difficult to get a local environment set up on your Mac, especially if you are working with a distributed system like Mesos. You want a simple way to get all of the essential files onto your computer, placed in the right directories, and ready to begin work. Enter Homebrew, which makes setup easy.
Using Homebrew to Install Mesos
Homebrew is an open source package management system for the Mac that simplifies installation of packages from source. It handles dependencies and updates automatically through a simple command line tool,
If you don't yet have Homebrew, you can install it with one command:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Once you have Homebrew installed, you can install Mesos on your laptop with these two commands:
brew updatebrew install mesos
You will need to wait while the most current, stable version of Mesos is downloaded, compiled, and installed on your machine. This could take upwards of 20 minutes (largely because
brew compiles Mesos locally), but Homebrew will let you know when it's finished by displaying a beer emoji in your terminal and a message like the following:
/usr/local/Cellar/mesos/0.19.0: 83 files, 24M, built in 17.4 minutes
Start Your Mesos Cluster
Now that you have Mesos installed on your laptop, it's easy to start your Mesos cluster. To see Mesos in action, spin up an in-memory master with the following command:
/usr/local/sbin/mesos-master --registry=in_memory --ip=127.0.0.1
A Mesos cluster needs at least one Mesos Master to coordinate and dispatch tasks onto Mesos Slaves. When experimenting on your laptop, a single master is all you need. Full production clusters, such as those you might run in a public cloud or in a private datacenter, will usually run Mesos in High Availability Mode. A highly-available Mesos cluster (designed for fault-tolerance with no single point of failure) will often have three or more masters running.
Once your Mesos Master has started, you can visit its management console: http://localhost:5050
Since a Mesos Master needs slaves onto which it will dispatch jobs, you might also want to run some of those. Mesos Slaves can be started by running the following command for each slave you wish to launch:
sudo /usr/local/sbin/mesos-slave --master=127.0.0.1:5050