Hello there lovely macOS user - welcome to our build instructions.
These instructions are for people wanting to build/compile their own version of Sonic Pi. If you're just looking to install it, we've already done all of this work for you and you can grab the latest signed pre-built version of the app here:
https://github.com/samaaron/sonic-pi/releases
If you're definitely sure you want to build your own release, then we really hope that these instructions help. Please let us know if you have any issues following them so we may continuously improve things.
https://in-thread.sonic-pi.net
OK, so just to get you prepared, we're going to do a few things:
- Install the various dependencies that Sonic Pi needs both to be built and to run
- Prepare the build by running some command scripts
- Build Sonic Pi using
cmake
- Start your new Sonic Pi using your newly built app
These build instructions assume you're running under macOS 10.15+. If you're using an older version of macOS some steps may need modification.
In order to build Sonic Pi's various components, we need to install a few dependencies:
- Xcode (12.1+) and command line tools
- Homebrew
- All other dependencies - Qt (5.15+), CMake (3.18+)
Firstly open the App Store and install the latest Xcode (12.1 at the time of writing). Also install the command line tools which will give you access to a compiler necessary to build the GUI and other components.
Install Homebrew by running the following within a terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Note that running arbitrary scripts from the internet via curl
is
usually a bad idea from a security perspective. Whilst, Homebrew is a
trusted system used by many developers globally you're always
recommended to read any scripts before executing them to reassure
yourself they aren't doing anything malicious.
Once you have Homebrew installed, pulling in the rest of the dependencies is a couple of lines to execute within a terminal:
brew install qt cmake
Once we have installed all the dependencies, we're almost ready to build Sonic Pi. However, we must first grab a copy of Sonic Pi's source code.
The easiest way of getting this is likely to be cloning from GitHub
into a folder on your hard drive such as ~/Development/sonic-pi
:
git clone https://github.com/samaaron/sonic-pi.git ~/Development/sonic-pi
If you don't have Git installed you should be able to download a .zip
file of the latest commit or specific release (v3.3+) you'd like to
build:
https://github.com/samaaron/sonic-pi/archive/main.zip
From now on these instructions will assume you downloaded the source
into ~/Development/sonic-pi
. If you used a different location be sure to
change any future references to ~/Development/sonic-pi
to your chosen location.
Nowe we're ready to build everything. This is achieved with 3 commands which will:
- Run the prebuild script which builds and sets up a lot of the dependencies.
- Run the config script to set up the build system.
- Run cmake to build the final entry-point binary.
Firstly, we need to change to the qt
directory which is within app/gui
:
cd ~/Development/sonic-pi/app/gui/qt
Next we run the prebuild and config scripts:
./mac-prebuild.sh
./mac-config.sh
Once these have completed (it might take a while the first time you run
a build) you'll find that you now have a build
directory that's
waiting for you to run your first build:
cd build
cmake --build . --config Release
Finally, you can run your newly compiled Sonic Pi
app within the build
directly either by double clicking it in the Finder or via the terminal
(from within the build
directory):
./Sonic\ Pi.app/Contents/MacOS/Sonic\ Pi
Good luck and please share your new live coding adventure with us over on: