If you are not sure what the following commands do, please check the descriptions below and make sure the operations before running them.
git clone https://github.com/google/mozc.git
cd mozc/src
python3 build_tools/update_deps.py
# CMake is also required to build Qt.
python3 build_tools/build_qt.py --release --confirm_license
MOZC_QT_PATH=${PWD}/third_party/qt bazelisk build package --config oss_macos --config release_build
open bazel-bin/mac/Mozc.pkg
💡 With the above build steps, the target CPU architecture of the binaries in
Mozc.pkg is the same as the CPU architecture of the build environment. That
is, if you build Mozc on arm64 environment, Mozc.pkg contains arm64 binaries.
See the
"how to specify target CPU architectures"
section below about how to do cross build.
💡 You can also download Mozc.pkg from GitHub Actions. Check
Build with GitHub Actions for details.
64-bit macOS 12 and later versions are supported.
Building on Mac requires the following software.
- Xcode
- Xcode 16.0 or later
⚠️ Xcode Command Line Tools aren't sufficient.
- Bazelisk
- Bazelisk is a wrapper of Bazel to use the specific version of Bazel.
- src/.bazeliskrc controls which version of Bazel is used.
- Python 3.12 or later.
- CMake 3.18.4 or later (to build Qt6)
You can download Mozc source code as follows:
git clone https://github.com/google/mozc.git
cd mozc/src
Hereafter you can do all the operations without changing directory.
python build_tools/update_deps.py
In this step, additional build dependencies will be downloaded.
You can specify --noqt option if you would like to use your own Qt binaries.
python3 build_tools/build_qt.py --release --confirm_license
Drop --confirm_license option if you would like to manually confirm the Qt
license.
You can also specify --debug option to build debug version of Mozc.
python3 build_tools/build_qt.py --release --debug --confirm_license
You can also specify --macos_cpus option, which has the same semantics as the
same name option in Bazel,
for cross-build including building a Universal macOS Binary.
# Building x86_64 binaries regardless of the host CPU architecture.
python3 build_tools/build_qt.py --release --debug --confirm_license --macos_cpus=x86_64
# Building Universal macOS Binary for both x86_64 and arm64.
python3 build_tools/build_qt.py --release --debug --confirm_license --macos_cpus=x86_64,arm64
You can skip this process if you have already installed Qt prebuilt binaries.
CMake is also required to build Qt. If you use brew, you can install cmake
as follows.
brew install cmake
MOZC_QT_PATH=${PWD}/third_party/qt bazelisk build package --config oss_macos --config release_build
open bazel-bin/mac/Mozc.pkg
To build an Intel64 macOS binary regardless of the host CPU architecture.
python3 build_tools/build_qt.py --release --debug --confirm_license --macos_cpus=x64_64
MOZC_QT_PATH=${PWD}/third_party/qt bazelisk build package --config oss_macos --config release_build --macos_cpus=x64_64
open bazel-bin/mac/Mozc.pkg
To build a Universal macOS Binary both x86_64 and arm64.
python3 build_tools/build_qt.py --release --debug --confirm_license --macos_cpus=x86_64,arm64
MOZC_QT_PATH=${PWD}/third_party/qt bazelisk build package --config oss_macos --config release_build --macos_cpus=x86_64,arm64
open bazel-bin/mac/Mozc.pkg
MOZC_QT_PATH=${PWD}/third_party/qt bazelisk test ... --config oss_macos --build_tests_only -c dbg
See build Mozc in Docker for details.
You can modify variables in src/config.bzl to fit your environment. Note: ~
does not represent the home directory. The exact path should be specified (e.g.
MACOS_QT_PATH = "/Users/mozc/myqt").
Tips: the following command makes the specified file untracked by Git.
git update-index --assume-unchanged src/config.bzl
This command reverts the above change.
git update-index --no-assume-unchanged src/config.bzl
GitHub Actions steps are already set up in macos.yaml. With that, you can build and install Mozc with your own commit as follows.
- Fork https://github.com/google/mozc to your GitHub repository.
- Push a new commit to your own fork.
- Click "Actions" tab on your fork.
- Wait until the action triggered with your commit succeeds.
- Download
Mozc.pkgfrom the action result page. - Install
Mozc.pkg.
Files in the GitHub Actions page remain available up to 90 days.
You can also find Mozc Installers for macOS in google/mozc repository. Please keep in mind that Mozc is not an officially supported Google product, even if downloaded from https://github.com/google/mozc/.
- Sign in GitHub.
- Check recent successful macOS runs in google/mozc repository.
- Find action in last 90 days and click it.
- Download
Mozc.pkgfrom the action result page.
Please check the previous version for more information. https://github.com/google/mozc/blob/3.33.6089/docs/build_mozc_in_osx.md#build-with-gyp-maintenance-mode