-
Notifications
You must be signed in to change notification settings - Fork 42
How to build chromium on macOS
- A 64-bit Mac running 10.12+.
- Xcode 8+.
- The OS X 10.12 SDK.
Run$ ls `xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs
to check whether you have it. Building with a newer SDK works too, but the releases currently use the 10.12 SDK.
-
Clone the depot_tools repository:
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
-
Add depot_tools to the end of your PATH (you will probably want to put this in your ~/.bash_profile). Assuming you cloned depot_tools to /path/to/depot_tools:(note: you must use the absolute path or Python will not be able to find infra tools):
$ export PATH="$PATH:/path/to/depot_tools"
-
Ensure that unicode filenames aren't mangled by HFS:
$ git config --global core.precomposeUnicode true
-
Create a chromium directory for the checkout and change to it (you can call this whatever you like and put it wherever you like, as long as the full path has no spaces):
$ mkdir chromium && cd chromium
-
Clone the chromium-src repository:
$ git clone https://github.com/otcshare/chromium-src.git
-
Create .gclient file and edit the file to contain the following arguments:
$ vim .gclient
solutions = [
{
"url": "http://github.com/otcshare/chromium-src.git@webml",
"managed": False,
"name": "chromium-src",
"deps_file": ".DEPS.git",
"custom_deps": {},
},
]
-
Make sure the proxy settings is correct in terminal:
$ export http_proxy=http://proxy_addr:proxy_port
$ export https_proxy=https://proxy_addr:proxy_port
-
Create .boto file and edit the file to contain the following arguments:
$ vim .boto
[boto]
proxy=http://proxy_addr
proxy_port=proxy_port
-
Add .boto config to the system env (you will probably want to put this in your ~/.bash_profile).
$ export NO_AUTH_BOTO_CONFIG="/path/to/.boto"
-
The remaining instructions assume you have switched to the src directory:
$ cd chromium-src
-
To update an existing checkout, you can run:
$ gclient sync
-
You can now run the Chromium-specific hooks, which will download additional binaries and other things you might need:
$ gclient runhooks
-
Chromium uses Ninja as its main build tool along with a tool called GN to generate .ninja files. You can create any number of build directories with different configurations. To create a build directory, run:
$ gn gen out/Default
-
To config the flags for WebNN, run gn args out/Default and edit the file to contain the following arguments:
$ gn args out/Default
target_os = "mac"
target_cpu = "x64"
is_debug = false
is_component_build = false
You only have to run this once for each new build directory, Ninja will update the build files as needed.
You can replace Default with another name, but it should be a subdirectory of out.
-
Build Chromium (the “chrome” target) with Ninja using the command:
$ autoninja -C out/Default chrome chrome_app
(autoninja is a wrapper that automatically provides optimal values for the arguments passed to ninja.)
- Once it is built, you can simply run the browser:
$ out/Default/Chromium.app/Contents/MacOS/Chromium