How to build manimgl from source on macOS
Manim is an engine for precise programmatic animations, designed for creating explanatory math videos.
Manim has two versions, a personal version maintained by 3blue1brown and a community version maintained by ManimCommunity. This article will demo a personal version of the demo on macOS maintained by 3blue1brown.
Download source code
Section titled “Download source code”cd ~/projectsgit clone https://github.com/3b1b/manim.gitcd manim
Creating an environment
Section titled “Creating an environment”conda create -n manim-build-from-source python=3.10conda activate manim-build-from-source
Install libraries
Section titled “Install libraries”mapbox-earcut
Section titled “mapbox-earcut”pip install mapbox-earcut
ffmpeg
Section titled “ffmpeg”brew install ffmpeg
mactex
Section titled “mactex”brew install mactex
This may take a little longer.
Verify mactex installation
Section titled “Verify mactex installation”Type latex --version
in the terminal.
latex --version
# OutputpdfTeX 3.141592653-2.6-1.40.26 (TeX Live 2024)kpathsea version 6.4.0Copyright 2024 Han The Thanh (pdfTeX) et al.There is NO warranty. Redistribution of this software iscovered by the terms of both the pdfTeX copyright andthe Lesser GNU General Public License.For more information about these matters, see the filenamed COPYING and the pdfTeX source.Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.Compiled with libpng 1.6.43; using libpng 1.6.43Compiled with zlib 1.3.1; using zlib 1.3.1Compiled 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.
brew info mactex
# Output❯ brew info mactex==> mactex: 2024.0312https://www.tug.org/mactex/Installed/opt/homebrew/Caskroom/mactex/2024.0312 (5.6GB)From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/m/mactex.rb==> NameMacTeX==> DescriptionFull TeX Live distribution with GUI applications==> Dependenciesghostscript==> Artifactsmactex-20240312.pkg (Pkg)==> CaveatsYou must restart your terminal window for the installation of MacTeX CLItools to take effect.
Alternatively, Bash and Zsh users can run the command:
eval "$(/usr/libexec/path_helper)"
==> Analyticsinstall: 3,166 (30 days), 7,794 (90 days), 30,329 (365 days)
Copy the highlighted path and open it in the terminal.
open /opt/homebrew/Caskroom/mactex/2024.031
You will see a file named mactex-<date>.pkg
tree /opt/homebrew/Caskroom/mactex/2024.0312/opt/homebrew/Caskroom/mactex/2024.0312└── mactex-20240312.pkg
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
Section titled “Build from source”pip install -e ./manim
Verify manimgl installation
Section titled “Verify manimgl installation”which manimgl # output: /opt/anaconda3/envs/manim-build-from-source/bin/manimgl
This may vary slightly from system to system, but can be verified by the name of the virtual environment,
as long as manimgl
is from the manim-build-from-source/bin/manimgl
directory. Then there is no problem.
Use manimgl
Section titled “Use manimgl”cd ~/projects/manimmanimgl example_scenes.py TexTransformExample
You should be able to see the animation below.
Congratulations, you have completed all the steps.
Additional
Section titled “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.