How to build manimgl from source on macOS

Wuzi

October 2024, 23

3 min read

How to build manimgl from source on macOS

Manim is an engine for precise programmatic animations, designed for creating explanatory math videos.

Download source code

Terminal window
1
cd ~/projects
2
git clone https://github.com/3b1b/manim.git
3
cd manim

Creating an environment

Terminal window
1
conda create -n manim-build-from-source python=3.10
2
conda activate manim-build-from-source

Install libraries

mapbox-earcut

Terminal window
1
pip install mapbox-earcut

ffmpeg

Terminal window
1
brew install ffmpeg

mactex

Terminal window
1
brew install mactex

Verify mactex installation

Type latex --version in the terminal.

Terminal window
1
latex --version
2
3
# Output
4
pdfTeX 3.141592653-2.6-1.40.26 (TeX Live 2024)
5
kpathsea version 6.4.0
6
Copyright 2024 Han The Thanh (pdfTeX) et al.
7
There is NO warranty. Redistribution of this software is
8
covered by the terms of both the pdfTeX copyright and
9
the Lesser GNU General Public License.
10
For more information about these matters, see the file
11
named COPYING and the pdfTeX source.
12
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
13
Compiled with libpng 1.6.43; using libpng 1.6.43
14
Compiled with zlib 1.3.1; using zlib 1.3.1
15
Compiled with xpdf version 4.04

If the output is as above, then congratulations, mactex has been installed successfully. You can proceed to next step.

Otherwise, please continue. We need to fix this. I’m not sure why, but sometimes, after brew install mactex finishes, it just downloads a package to your disk. You still need to install it manually.

Terminal window
1
brew info mactex
2
3
# Output
4
brew info mactex
5
==> mactex: 2024.0312
6
https://www.tug.org/mactex/
7
Installed
8
/opt/homebrew/Caskroom/mactex/2024.0312 (5.6GB)
9
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/m/mactex.rb
10
==> Name
11
MacTeX
12
==> Description
13
Full TeX Live distribution with GUI applications
14
==> Dependencies
15
ghostscript
16
==> Artifacts
17
mactex-20240312.pkg (Pkg)
18
==> Caveats
19
You must restart your terminal window for the installation of MacTeX CLI
20
tools to take effect.
21
22
Alternatively, Bash and Zsh users can run the command:
23
24
eval "$(/usr/libexec/path_helper)"
25
26
==> Analytics
27
install: 3,166 (30 days), 7,794 (90 days), 30,329 (365 days)

Copy the highlighted path and open it in the terminal.

Terminal window
1
open /opt/homebrew/Caskroom/mactex/2024.031

You will see a file named mactex-<date>.pkg

1
tree /opt/homebrew/Caskroom/mactex/2024.0312
2
/opt/homebrew/Caskroom/mactex/2024.0312
3
└── mactex-20240312.pkg
4
5
1 directory, 1 file

Open this file and install it manually.

After the installation is complete, retry Verify mactex installation, now mactex should work.

Build from source

Terminal window
1
pip install -e ./manim

Verify manimgl installation

Terminal window
1
which manimgl # output: /opt/anaconda3/envs/manim-build-from-source/bin/manimgl

Use manimgl

Terminal window
1
cd ~/projects/manim
2
manimgl example_scenes.py TexTransformExample

You should be able to see the animation below.

Congratulations, you have completed all the steps.

Additional

If you otherwise encounter problems with installation and use, you can create an Issue at here.

Look through the example scenes to see examples of the library’s syntax, animation types and object types.

In the 3b1b/videos repo, you can see all the code for 3blue1brown videos.

Share to X