My favorites | Sign in
Project Home Downloads Wiki Issues
Search
for
MacBuildInstructions  
Build instructions for Chromium on Mac OS X
Updated May 18, 2012 by maruel@chromium.org

Prerequisites

  • An Intel Mac running 10.6 (“Snow Leopard”) or 10.7. V8 does not support PowerPC, 10.5 ("Leopard") is unable to link the larger Chromium libraries, and the code does not link with linker gcc included with any Xcode version less than 3.2.6.
  • XCode 3.2.6 (Snow Leopard; see Xcode4Tips for notes on using Xcode 4.x). You can choose to install the iPhone version or not, it doesn't matter. The optional "Unix Developer Tools" are required.
  • Install gclient, part of the depot_tools package (download). gclient is a wrapper around svn that we use to manage our working copies. Note: If you use python25 from MacPorts, you also need to install py25-socket-ssl, otherwise "gcl upload" will fail with the error message "AttributeError: 'module' object has no attribute 'HTTPSHandler'". Use the command "sudo port install py25-socket-ssl" to install it.
  • (optional) Install git.

Getting the code

Check out the source code using the direct svn checkout method if you plan on staying current with the project. As the tarball may not be svn 1.4 compatible, updating it per the instructions probably won't work and you're left with a half-updated tree that doesn't build.

Before checking out, go to the waterfall and check that the source tree is open (to avoid pulling a broken tree).

The path to the build directory should not contain spaces (e.g. not "~/Mac OS X/chromium"), as this will cause the build to fail.

Building

Chromium can be built using several build systems: Xcode 3.6.2 or 4.x with the UI or xcodebuild, make, and ninja. If you can't live without an IDE, use Xcode. Else, use ninja, since it has by far the lowest build times. See instructions for building on Mac using ninja and make.

XCode 4

See Xcode4Tips for required steps to make it work. Even when using ninja.

Using XCode UI

The Xcode project files are generated from GYP files. Running gclient sync will bring the source code up-to-date and will automatically generate the project files. You can also (re-)generate the project files by calling gclient runhooks at any time.

To build all of the targets, open ~/chromium/src/build/all.xcodeproj and build the All target. Assuming the waterfall is green, building the All target should not produce any errors and will generate both TestShell and Chromium applications. If you want just the browser, build target chrome. When you work on the browser, you usually open just src/chrome/chrome.xcodeproj, which makes Xcode a bit more responsive that working with all.xcodeproj.

If you have problems building, join us in #chromium on irc.freenode.net and ask there. As mentioned above, be sure that the waterfall is green and the tree is open before checking out. This will increase your chances of success.

Letting the build not kill your Mac

xcode will run many ld processes in parallel, each taking > 1 GB of RAM. http://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/54cf7662fc3ea251/a782d309b03eed79 has instructions on how you can limit the number of ld processes if your machine becomes unresponsive during linking. Do this. (This is not required if you build with ninja or make: They do this automatically.)

(An old version of this page also recommended setting PBXNumberOfParallelBuildSubtasks, but as of Chrome r76000 this is no longer necessary. You can run defaults delete com.apple.Xcode PBXNumberOfParallelBuildSubtasks to make sure all your cores are used when building.)

Building from the command line with xcodebuild

If want to build from the command line, you almost certainly want to use ninja instead, see above. But it's possible with xcodebuild, too:

To build just chrome using the Debug configuration (Release is the other option):

cd ~/chromium/src/chrome
xcodebuild -project chrome.xcodeproj -configuration Debug -target chrome

In addition, to make the build output less spammy and more readable, you can pipe it through build/sanitize-mac-build-log.sh.

Faster builds

Full rebuilds are about the same speed in Debug and Release, but linking is a lot faster in Release builds.

Run

GYP_DEFINES=fastbuild=1 build/gyp_chromium

to disable debug symbols altogether, this makes both full rebuilds and linking faster (at the cost of not getting symbolized backtraces in gdb).

You might also want to install ccache to speed up the build.

Running

All build output is located in the xcodebuild directory (in the example above, ~/chromium/src/xcodebuild), or out if you use ninja or make. You can find the applications at {Debug|Release}/TestShell.app and {Debug|Release}/Chromium.app, depending on the selected configuration.

Unit Tests

We have several unit test targets that build, and tests that run and pass:

  • unit_tests from chrome/chrome.xcodeproj
  • base_unittests from base/base.xcodeproj
  • net_unittests from net/net.xcodeproj
  • googleurl_unittests from build/googleurl.xcodeproj
  • chrome_unittests from chrome/chrome.xcodeproj

When these tests are built, you will find them in the xcodebuild/{Debug|Release} directory. You can run them from the command line. Note that when running from the command line you'll need to specify a full path to the executable, like this:

`pwd`/unit_tests

Coding

According to the Chromium style guide code is not allowed to have whitespace on the ends of lines. Xcode loves adding whitespace to the ends of lines which can make editing in Xcode more painful than it should be. The GTM Xcode Plugin adds a preference panel to Xcode that allows you to strip whitespace off of the ends of lines on save. Documentation on how to install it is here.

Debugging

Good debugging tips can be found here.

Contributing

Once you’re comfortable with building Chromium, check out Contributing Code for information about writing code for Chromium and contributing it.

Building on 10.5

This is unsupported and currently doesn't work out of the box. If you want to do serious chrome/mac development, you should use 10.6.

For debug builds, you need to get a 64-bit linker. This thread describes how. The linker needs to be at least the version of ld bundled with Xcode 3.2.3, else it'll crash when linking unit tests.

You need to use the make build, since Xcode 3.1 (the last Xcode supported on 10.5) can't handle how we invoke clang.

Comment by Takano.N...@gmail.com, Nov 17, 2008

I check out the whole source code, but I could not build it... There are lots of errors.

Comment by mav...@gmail.com, Nov 26, 2008

@Takano Naoki: make sure the tree is open when you do a checkout. If you just want to have a look at the state of things, you can find TestShell? builds here.

Comment by Takano.N...@gmail.com, Dec 3, 2008

Thank you, mavink. Now I can build on my environment ;-)

Comment by bradlambeth, Feb 10, 2009

Is there a way to get around building webkit every time? Could I just install the upstream nightly build and set up xcode to use some of the prebuilt webkit rather than all of the webkit source from chromium? This question applies for the other third party libraries too, like libxslt. I have many of these installed through macports and yet xcode seems to build the chromium-sourced version every time.

Comment by jstot...@gmail.com, Mar 20, 2009

"To build all of the targets, open ~/chromium/src/build/all.xcodeproj and build the All target"

There is no all.xcodeproj after a fresh sync.

Comment by jstot...@gmail.com, Mar 20, 2009

"To work on TestShell? directly, open src/webkit/tools/test_shell/mac/TestShell?.xcodeproj in XCode and build the TestShell? target."

Nor is there a TestShell?.xcodeproj file....

Comment by filcab@gmail.com, Mar 21, 2009

I have a problem building Chrome. A time.h in chrome is getting included instead of the system one when, in pthread.h (system), I have #include <time.h>

Example: CompileC ../xcodebuild/base.build/Debug/base.build/Objects-normal/i386/prtime.o /Users/filcab/dev/stuff/google/src/base/third_party/nspr/prtime.cc normal i386 c++ com.apple.compilers.gcc.4_2

cd /Users/filcab/dev/stuff/google/src/base /Developer/usr/bin/gcc-4.2 -x c++ -arch i386 -fmessage-length=0 -pipe -Wno-trigraphs -O0 -mdynamic-no-pic -Werror -Wnewline-eof -DCHROMIUM_BUILD -isysroot /Developer/SDKs/MacOSX10.5.sdk -fvisibility=hidden -fvisibility-inlines-hidden -mmacosx-version-min=10.5 -gdwarf-2 -Wall -Wendif-labels -F/Users/filcab/dev/stuff/google/src/base/../xcodebuild/Debug -I/Users/filcab/dev/stuff/google/src/base/../xcodebuild/Debug/include -I../third_party/icu38/public/common -I../third_party/icu38/public/i18n -I.. -I/Users/filcab/dev/stuff/google/src/base/../xcodebuild/base.build/Debug/base.build/DerivedSources? -c /Users/filcab/dev/stuff/google/src/base/third_party/nspr/prtime.cc -o /Users/filcab/dev/stuff/google/src/base/../xcodebuild/base.build/Debug/base.build/Objects-normal/i386/prtime.o
In file included from /Developer/SDKs/MacOSX10.5.sdk/usr/include/pthread.h:60,
from /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h:43, from /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h:114, from /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h:37, from /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/iosfwd:46, from /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/stl_algobase.h:69, from /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/char_traits.h:46, from /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/string:46, from ../base/logging.h:8, from ../base/third_party/nspr/prtime.h:55, from /Users/filcab/dev/stuff/google/src/base/third_party/nspr/prtime.cc:66:
./time.h:213: error: 'time_t' has not been declared ./time.h:214: error: 'time_t' does not name a type

The time.h that gets included is in src/base/base/time.h

Comment by rsesek, Mar 26, 2009

I've posted a pre-built version on my website as well as the build instructions I used. It seems that you have to use "gclient sync" to generate the Xcode project files (all.xcodeproj).

http://www.bluestatic.org/chromium/

Comment by filcab@gmail.com, Mar 28, 2009

Thanks for the link... But even if I follow those instructions, I get the same error... somehow the src/base directory is getting included in the include search path... and time.h is getting ingluded when the system's pthread.h includes <time.h>...

Any clues?

Comment by sandrine...@gmail.com, Mar 29, 2009

It would be great to have some binary downloadable at some point like Webkit nightly provide.

Comment by emei...@gmail.com, Mar 30, 2009

In Tiger, it won't run ?

Comment by rsesek, Apr 2, 2009

Try reading the second section called "Prerequisites." Leopard only.

Comment by Nikita.S...@gmail.com, May 6, 2009

Hi! I'm having a problem with syncing gclient. The process as I can see in the terminal goes well, but when the files stop downloading there is neither /src/build/all.xcodeproj file, nor src/webkit/tools/test_shell/TestShell?.xcodeproj one. Can anyone help me with this? The waterfall at the moment of syncing was green. Thanks!

Comment by muhamm...@gmail.com, May 15, 2009

Would it be possible to add Sparkle (http://sparkle.andymatuschak.org/) to Chrome so that it is easy for testers to update automatically rather than manually?

Comment by rsesek, May 16, 2009

Nikita: Do you have a src/chrome/chrome.xcodeproj?

muhammadk: They'll probably use Google Update eventually. That's a lower priority, though.

Comment by djst...@xs4all.nl, May 17, 2009

rsesek: I'm running into the same problems as Nikita, no All.xcodeproj, no chrome.xcodeproj either.

I have tried both downloading and unarchiving the tarball and using gclient to checkout the source code directly. (using SVN 1.5.6, so no issues there either). In both cases, the .xcodeproj files are MIA.

It seems like both .xcodeproj files have been removed from the trunk at some point in the past.

Comment by youwantj...@gmail.com, May 19, 2009

Yep same problem here of course. No All.xcodeproj and no chrome.xcodeproj please advise.

Comment by youwantj...@gmail.com, May 19, 2009

in 2.0.x the all.xcodeproj seems to be replaced by all.gyp. The latest release with the all.xcodeproj is 1.0.145.65. I haven't found a copy of chrome.xcodeproj in any of the sources.

Comment by stuart.morgan, May 19, 2009

The Xcode projects are generated from the gyp files on checkout. If for some reason that step didn't run for you, you can generate them with 'gclient runhooks --force'

Comment by youwantj...@gmail.com, May 20, 2009

Thanks, I pulled it again normally using gclient. It converted the files. I'm compiling now.

Comment by dririan, May 30, 2009

I pulled the source (with a green waterfall), and found no .xcodeproj files. I ran 'gclient runhooks --force', and it gave no output, yet no Xcode projects were made. Am I doing something wrong?

Comment by splee...@gmail.com, Jun 3, 2009

I'm having a similar issue. No .xcodeproj files. The output of gclient runhooks --force is below:

gclient runhooks --force

________ running '/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python src/tools/gyp/gyp_dogfood src/build/all.gyp' in '/Users/splee/projects/chromium'
/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python: can't open file 'src/tools/gyp/gyp_dogfood': [Errno 2] No such file or directory
failed to run command: /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python src/tools/gyp/gyp_dogfood src/build/all.gyp
Comment by ahendrickson%chromium.org@gtempaccount.com, Mar 24, 2010

Getting subversion via MacPorts?:

sudo port install subversion

Comment by jonatanc...@gmail.com, May 4, 2010

I'm just wondering... why we can't just get a binary file and avoid all the compiling stuff?

Comment by sergio.a...@gmail.com, May 8, 2010

@jonatan@bylinebreak.com: you should go to http://www.google.com/chrome

Comment by mdaniel, May 22, 2010

Just in case it confuses someone else, the depot_tools and newly created src directory should be at the same level in your working directory:

$ ls -a
.gclient
depot_tools
src

After it tried to gclient sync the src tree from Subversion, I came back and re-read the instructions to see what I had done wrong, and only then did I have the ah-ha moment.

I hope this helps someone else, and hope Those In Charge(tm) can update the wiki.

Comment by silviu.a...@gmail.com, Dec 1, 2010

Does the Debug version offer more information about what links a user clicked on or what a user typed into a text field? If so, where can I see this information?

Thanks, Silviu

Comment by msw%chro...@gtempaccount.com, Dec 16, 2010

Note that even Volume labels should not contain spaces! I'd edit the wiki page, but apparently it won't let me now...

Comment by Skeleton...@gmail.com, Dec 27, 2010

It seems that gclient sync work well!

Comment by Skeleton...@gmail.com, Dec 27, 2010

but i have to rename a directory in src to whatever!

Comment by MarkBron...@gmail.com, Apr 8, 2011

Everything with the download/unpacking seemed to go well, and the compilation...but the linking process for me seems to hang on pdfsqueeze (37/241) when trying to build just chrome. I know the entire process should take a while, but it was actually making significant progress until that one (seemingly innocuous) step. I ran the script to limit the number of parallel ld processes, in case that matters. Any thoughts?

Comment by tayfunelmas, Aug 13, 2011

I am building Chromium on Mac OS X 10.7 Lion. Although it is not recommended to build it on Mac OS X 10.5, the build scripts always complaining about not founding 10.5 SDK. In addition, when I opened the project files in Xcode, all projects seem to be configured to use 10.5 SDK.

Here is an error message I get when I try to build it from the command line:

BUILD NATIVE TARGET protobuf_full_do_not_use OF PROJECT protobuf WITH CONFIGURATION Release Check dependencies BEROR?error: There is no SDK with the name or path '/Users/elmas/Repository/Research/ParLab??/JavaScript??/chromium/src/chrome/macosx10.5'

BUILD FAILED

Comment by gerrit.v...@gmail.com, Nov 29, 2011

Chromium build hangs in a loop:

I stopped the compile process, but bash was still hanging, so had to force-stop this; cannot find anything of shlock, please help!

BUILD AGGREGATE TARGET webkit_system_interface Support OF PROJECT WebCore? WITH CONFIGURATION Release

Check dependencies

PhaseScriptExecution? "Action \"Adjust Visibility\"" "../../../../../xcodebuild/WebCore?.build/Release/webkit_system_interface Support.build/Script-C2FA7E609918094ADF85F31E.sh"

cd /Users/gveldman/chromium/src/third_party/WebKit?/Source/WebCore?/WebCore?.gyp /bin/sh -c "\"/Users/gveldman/chromium/src/third_party/WebKit?/Source/WebCore?/WebCore?.gyp/../../../../../xcodebuild/WebCore?.build/Release/webkit_system_interface Support.build/Script-C2FA7E609918094ADF85F31E.sh\""
shlock: USAGE: shlock -f file -p pid [-d][-u] /Developer/usr/bin/ld: line 6: -f: command not found /Developer/usr/bin/ld: line 8: [: missing `]' /Developer/usr/bin/ld: line 9: -eq: command not found shlock: USAGE: shlock -f file -p pid [-d][-u] /Developer/usr/bin/ld: line 6: -f: command not found /Developer/usr/bin/ld: line 8: [: missing `]' /Developer/usr/bin/ld: line 9: -eq: command not found … and so on...

Comment by kenneth1...@hotmail.es, Dec 7, 2011

Chromiun is the best browser but i want to compile it in 64 bits mac os x

Comment by lin...@gmail.com, Dec 18, 2011

1> running 'svn update /Volumes/MacData?/Dependencies/chromium/trunk --non-interactive --accept postpone --ignore-externals' in '/Volumes/MacData?/Dependencies/chromium' 1>Updating 'trunk': 1>At revision 114937. Syncing projects: 50% (1/2), done.k

why always 50percent and run gclient runhooks --force none xcodeproj generate.

Comment by lin...@gmail.com, Dec 18, 2011

ccmatoMacBook-Pro:build xxxx$ GYP_DEFINES='mac_sdk=10.6' gclient runhooks --force .gclient file in parent directory /Volumes/MacData?/Dependencies/chromium/trunk/src might not be the file you want to use c


Sign in to add a comment
Powered by Google Project Hosting