Skip to content

Instantly share code, notes, and snippets.

@jakub300
Last active January 9, 2022 01:48
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save jakub300/dc31866cb8e3cf4e135dd623ca2e2b81 to your computer and use it in GitHub Desktop.
Save jakub300/dc31866cb8e3cf4e135dd623ca2e2b81 to your computer and use it in GitHub Desktop.
Compile headless shell (Chromium)
# Based on:
# https://web.archive.org/web/20200212121848/http://www.zackarychapple.guru/chrome/2016/08/24/chrome-headless.html
# https://www.chromium.org/developers/how-tos/get-the-code
# https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
apt-get update
apt-get install -y curl git htop man unzip vim wget python
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=$PATH:`pwd`/depot_tools
mkdir Chromium && cd Chromium
fetch --no-history chromium
cd src
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
./build/install-build-deps.sh --no-prompt
gclient runhooks
mkdir -p out/Headless
echo 'import("//build/args/headless.gn")' > out/Headless/args.gn
echo 'is_debug = false' >> out/Headless/args.gn
gn gen out/Headless
ninja -C out/Headless headless_shell
tar -zcvf ChromeHeadless.tar.gz out/Headless
@pojntfx
Copy link

pojntfx commented Apr 15, 2020

Thanks so much for this! The official instructions, especially on dependencies, are complex - this makes everything much simpler ;)

@pojntfx
Copy link

pojntfx commented Apr 15, 2020

Just one small nitpick: With the above installation, pkg-config is missing. Adding pkg-config to the apt-get install line fixes the issue.

@CarlosVilasAlvarez
Copy link

I think the first link is not working... xD

@lom-chargebacks
Copy link

I think the first link is not working... xD

Definitely, NSFW

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment