blob: d6dcc03adccc893f7e5df6025ea50d8554914448 [file] [log] [blame] [view]
Kristina Chodorow974b2082015-03-31 14:49:30 +00001---
dzc22b85a22017-05-31 20:37:50 +02002layout: documentation
3title: Installing Bazel
Kristina Chodorow974b2082015-03-31 14:49:30 +00004---
dzc22b85a22017-05-31 20:37:50 +02005
6# Installing Bazel
7
8See the instructions for installing Bazel on:
9
10* [Ubuntu Linux (16.04, 15.10, and 14.04)](install-ubuntu.md)
Jakob Buchgraber63a6e912017-09-25 19:06:19 +020011* [Fedora 25, 26, and CentOS 7](install-redhat.md)
dzc22b85a22017-05-31 20:37:50 +020012* [Mac OS X](install-os-x.md)
Googler1a72fb72017-09-12 14:18:30 +020013* [Windows](install-windows.md)
dzc22b85a22017-05-31 20:37:50 +020014
15For other platforms, you can try to [compile from source](install-compile-source.md).
16
17Required Java version:
18
19Java JDK 8 or later is required. To address the problem of JDK 8 not being
20available on some machines, Bazel's binary installer embeds a JDK by default.
21
22**Note:** Homebrew and Debian packages do not contain the embedded JDK. The
23shell installers are the only ones with an embedded JDK.
24
25Extras:
26
27* [Bash completion](#bash)
28* [zsh completion](#zsh)
29
30For more information on using Bazel, see
31[Getting Started with Bazel](getting-started.html).
32
dzc22b85a22017-05-31 20:37:50 +020033## <a name="bash"></a>Getting bash completion
34
35Bazel comes with a bash completion script, which the installer copies into the
36`bin` directory. If you ran the installer with `--user`, this will be
37`$HOME/.bazel/bin`. If you ran the installer as root, this will be
38`/usr/local/bazel/bin`.
39
40Copy the `bazel-complete.bash` script to your completion folder
41(`/etc/bash_completion.d` directory under Ubuntu). If you don't have a
42completion folder, you can copy it wherever suits you and insert
43`source /path/to/bazel-complete.bash` in your `~/.bashrc` file (under OS X, put
44it in your `~/.bash_profile` file).
45
46If you built Bazel from source, the bash completion target is in the `//scripts`
47package:
48
491. Build it with Bazel: `bazel build //scripts:bazel-complete.bash`.
502. Copy the script `bazel-bin/scripts/bazel-complete.bash` to one of the
51 locations described above.
52
53## <a name="zsh"></a>Getting zsh completion
54
55Bazel also comes with a zsh completion script. To install it:
56
571. Add this script to a directory on your $fpath:
58
59 ```
60 fpath[1,0]=~/.zsh/completion/
61 mkdir -p ~/.zsh/completion/
62 cp scripts/zsh_completion/_bazel ~/.zsh/completion
63 ```
64
65 You may have to call `rm -f ~/.zcompdump; compinit`
66 the first time to make it work.
67
682. Optionally, add the following to your .zshrc.
69
70 ```
71 # This way the completion script does not have to parse Bazel's options
72 # repeatedly. The directory in cache-path must be created manually.
73 zstyle ':completion:*' use-cache on
74 zstyle ':completion:*' cache-path ~/.zsh/cache
75 ```