MacOS Setup Documentation

Contents

Install Crafty on macOS

These instructions will guide you to install Crafty on macOS.

Requirements & Assumptions

Installation

1. Install Pre-Requisites
Brew.sh

macOS lacks a proper package manager and in order to install a couple of the required software via the command line you will need Brew.sh.

Go to your /Applications/Utilities and launch Terminal.app or press Command+Space and type Terminal.app and hit return/enter key. Then paste the line below:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

The command above runs and you will see the installation progress. It will inform you that the Command Line Tools for Xcode will get installed.

Towards the end you will be asked to enter your account password then the installation will continue.

You will be notified when Brew begins downloading the Command Line Tools for Xcode and depending on your connection the download will take about 5 minutes. Once the tools have downloaded, they will install on your mac and the installation of Brew will be completed.

Once the download and install are complete brew will list 3 commands you need to enter to add homebrew to PATH and MANPATH. If you do not complete those steps the rest of this install with be PAINFUL.

Those commands will look something like this:

==> Next steps:
- Run these three commands in your terminal to add Homebrew to your PATH:
    echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /Users/crafty/.zprofile
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/crafty/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
Installing Pre-Requisite Packages

This guide assumes you have the following software installed and up to date: Git, Python 3.7, and Java (Open JDK is fine).

First, install Git and Python 3.75

brew install git python3

then OpenJDK

brew install --cask homebrew/cask-versions/adoptopenjdk8

then upgrade pip

pip install --upgrade pip
2. Installing Crafty
Create a directory for Crafty

Let's make crafty a place to live on your server. This guide will use /var/opt/minecraft/crafty as it's example:

sudo mkdir -p /var/opt/minecraft/crafty
Setup permissions for the folder
sudo chown <your_username>:admin /var/opt/minecraft/crafty

For Example If your username on your mac is Totoro then the command will be: sudo chown totoro:admin /var/opt/minecraft/crafty

Change to the Crafty dir
cd /var/opt/minecraft/crafty
Create a virtual environment "venv"
python3 -m venv venv
Clone Crafty Repo

Please be sure to be in the crafty folder before cloning the repo. To check type pwd and make sure it says /var/opt/minecraft/crafty before you continue.

git clone https://gitlab.com/crafty-controller/crafty-4.git

Switch to the crafty-4 directory

cd crafty-4

Then lets make sure we are on the latest snapshot and lets checkout

git switch master

Let's go up one directory

cd ..
Activate the Virtual Environment

Lets activate the Virtual Environment

source venv/bin/activate

your prompt will change to (venv) whateveryourprompt is:

Go into the crafty-4 folder that was cloned down
cd crafty-4
Install all the things / requirements
pip install -r requirements.txt
Run Crafty
python main.py
How to Update
For updating you are going to repeat some steps listed above, but since you already must have done this before, the steps are listed below, just do them in that order. Please be sure to be in the crafty folder before cloning the repo. To check type pwd and make sure it says /var/opt/minecraft/crafty before you continue.
git clone https://gitlab.com/crafty-controller/crafty-4.git
cd /var/opt/minecraft/crafty/crafty-4
git pull
git checkout master
cd ..
source venv/bin/activate
cd /var/opt/minecraft/crafty-4
pip install -r requirements.txt
python main.py

Post-Install

Check out the Getting Started page.