Meson is implemented in Python 3, and requires 3.7 or newer. If youroperating system provides a package manager, you should install itwith that. For platforms that don't have a package manager, you needto download it from Python's home page. See below forplatform-specific Python3 quirks.
Downloading Meson
Meson releases can be downloaded from the GitHub release page, andyou can run ./meson.py
from inside a release or the git repositoryitself without doing anything special.
On Windows, if you did not install Python with the installer optionsthat make Python scripts executable, you will have to run python /path/to/meson.py
, where python
is Python 3.7 or newer.
The newest development code can be obtained directly from Git, andwe strive to ensure that it will always be working and usable. Allcommits go through a pull-request process that runs CI and testsseveral platforms.
Packing Meson into a zipapp
After downloading the release, you can create a standalone single-fileexecutable for Meson by running the script:
./packaging/create_zipapp.py --outfile meson.pyz --interpreter '/usr/bin/env python3' <source checkout>
This uses python's native support for zipapp.
Installing Meson with pip
Meson is available in the Python Package Index and can be installedwith pip3 install --user meson
. This does not require any specialprivileges. This will install the package in ~/.local/
, so you willhave to add ~/.local/bin
to your PATH
. If you are using Meson onlyfor local development this should be all you need.
If you need to install your project in system directories, thisapproach will not work as executable installed in this way are notavailable when sudo
is used. You can install Meson so it can be usedby every user with sudo pip3 install meson
. It is generally notrecommended to do this, but instead use the version provided by distropackages.
If you must install Meson with sudo pip3
make sure to uninstall anydistro version first. Having multiple versions of any program insystem directories can lead to problems.
Installing Meson and Ninja with the MSI installer
We provide an MSI installer on the GitHub release page that can beused to install both Meson and Ninja at once for Windows. It alsocontains an embedded copy of Python, so scripts that use the Pythonmodule and do not have any external dependencieswill continue to work as expected.
Please note that this is a new feature, so bug reports are expectedand welcome!
Dependencies
In the most common case, you will need the Ninja executable forusing the ninja
backend, which is the default in Meson. This backendcan be used on all platforms and with all toolchains, including GCC,Clang, Visual Studio, MinGW, ICC, ARMCC, etc.
You can use the version provided by your package manager if possible,otherwise download the binary executable from the Ninja project'srelease page.
If you will only use the Visual Studio backend (--backend=vs
) togenerate Visual Studio solutions on Windows or the XCode backend(--backend=xcode
) to generate XCode projects on macOS, you do notneed Ninja.
Windows Python3 quirks
When installing Python 3, it is highly recommended (but not required)that you select the installer options as follows:
With this, you will have python
and pip
in PATH
, and you caninstall Meson with pip. You will also be able to directly run meson
in any shell on Windows instead of having to run py -3
with the fullpath to the meson.py
script.
MSYS2 Python3 quirks
If you are using MSYS2 on Windows as your development environment,please make sure that you do not use the msys/python
package toprovide Python 3. Use either mingw32/mingw-w64-i686-python3
ormingw64/mingw-w64-x86_64-python3
depending on which MinGW target youare building for.
The results of the search are
Website licensing information are available on the Legal page.