CINXE.COM

Installation — Homebrew Documentation

<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Security-Policy" content="default-src 'none'; connect-src https://D9HG3G8GS4-dsn.algolia.net; font-src data: https://fonts.gstatic.com; img-src 'self' https://avatars2.githubusercontent.com https://avatars.githubusercontent.com; object-src 'none'; script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net ; style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net; "> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Installation — Homebrew Documentation</title> <!-- Begin Jekyll SEO tag v2.8.0 --> <meta name="generator" content="Jekyll v3.10.0"> <meta property="og:title" content="Installation"> <meta property="og:locale" content="en_US"> <meta name="description" content="Documentation for the missing package manager for macOS (or Linux)."> <meta property="og:description" content="Documentation for the missing package manager for macOS (or Linux)."> <link rel="canonical" href="https://docs.brew.sh/Installation"> <meta property="og:url" content="https://docs.brew.sh/Installation"> <meta property="og:site_name" content="Homebrew Documentation"> <meta property="og:image" content="https://docs.brew.sh/assets/img/homebrew-256x256.png"> <meta property="og:type" content="website"> <meta name="twitter:card" content="summary_large_image"> <meta property="twitter:image" content="https://docs.brew.sh/assets/img/homebrew-256x256.png"> <meta property="twitter:title" content="Installation"> <meta name="twitter:site" content="@MacHomebrew"> <meta property="article:publisher" content="https://www.facebook.com/machomebrew/"> <script type="application/ld+json"> {"@context":"https://schema.org","@type":"WebPage","description":"Documentation for the missing package manager for macOS (or Linux).","headline":"Installation","image":"https://docs.brew.sh/assets/img/homebrew-256x256.png","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://docs.brew.sh/assets/img/homebrew.svg"}},"url":"https://docs.brew.sh/Installation"}</script> <!-- End Jekyll SEO tag --> <meta name="viewport" content="width=device-width"> <link rel="icon" href="/assets/img/favicon.ico" sizes="48x48"> <link rel="icon" href="/assets/img/homebrew.svg" sizes="any" type="image/svg+xml"> <link rel="apple-touch-icon" href="/assets/img/apple-touch-icon.png"> <link rel="stylesheet" href="/assets/css/style.css" type="text/css" media="screen"> <link rel="preconnect" href="https://D9HG3G8GS4-dsn.algolia.net" crossorigin> <link rel="preload" href="https://cdn.jsdelivr.net/npm/@docsearch/css@3/dist/style.min.css" as="style" media="screen" onload="this.onload=null;this.rel='stylesheet'"> </head> <body> <div id="wrap"> <div id="header"> <img alt="Homebrew Documentation logo" src="/assets/img/homebrew.svg" width="128" height="128"> <h1><a href="/">Homebrew Documentation</a></h1> <div id="search-container"></div> </div> <div id="page"> <h1 id="installation">Installation</h1> <p>Instructions for a supported install of Homebrew are on the <a href="https://brew.sh">homepage</a>.</p> <p>The script installs Homebrew to its default, supported, best prefix (<code class="language-plaintext highlighter-rouge">/opt/homebrew</code> for Apple Silicon, <code class="language-plaintext highlighter-rouge">/usr/local</code> for macOS Intel and <code class="language-plaintext highlighter-rouge">/home/linuxbrew/.linuxbrew</code> for Linux) so that <a href="/FAQ#why-does-homebrew-say-sudo-is-bad">you don’t need <em>sudo</em> after Homebrew’s initial installation</a> when you <code class="language-plaintext highlighter-rouge">brew install</code>. This prefix is required for most bottles (binary packages) to be used. It is a careful script; it can be run even if you have stuff installed in the preferred prefix already. It tells you exactly what it will do before it does it too. You have to confirm everything it will do before it starts.</p> <p>The macOS <code class="language-plaintext highlighter-rouge">.pkg</code> installer also installs Homebrew to its default prefix (<code class="language-plaintext highlighter-rouge">/opt/homebrew</code> for Apple Silicon and <code class="language-plaintext highlighter-rouge">/usr/local</code> for macOS Intel) for the same reasons as above. It’s available on <a href="https://github.com/Homebrew/brew/releases/latest">Homebrew/brew’s latest GitHub release</a>. To specify an alternate install user, like in situations where the package is installed at the login window before a user has logged in, write a property list file to <code class="language-plaintext highlighter-rouge">/var/tmp/.homebrew_pkg_user.plist</code> with the value <code class="language-plaintext highlighter-rouge">HOMEBREW_PKG_USER</code>. For example, <code class="language-plaintext highlighter-rouge">defaults write /var/tmp/.homebrew_pkg_user HOMEBREW_PKG_USER penny</code>. The file and user must exist prior to install.</p> <h2 id="macos-requirements">macOS Requirements</h2> <ul> <li>A 64-bit Intel CPU or Apple Silicon CPU <sup><a href="#1">1</a></sup></li> <li>macOS Ventura (13) (or higher) installed on officially supported hardware<sup><a href="#2">2</a></sup> <ul> <li><strong>Note:</strong> Devices using OpenCore Legacy Patcher are not supported</li> </ul> </li> <li>Command Line Tools (CLT) for Xcode (from <code class="language-plaintext highlighter-rouge">xcode-select --install</code> or <a href="https://developer.apple.com/download/all/">https://developer.apple.com/download/all/</a>) or <a href="https://itunes.apple.com/us/app/xcode/id497799835">Xcode</a> <sup><a href="#3">3</a></sup></li> <li>The Bourne-again shell for installation (i.e. <code class="language-plaintext highlighter-rouge">bash</code>) <sup><a href="#4">4</a></sup></li> </ul> <h2 id="advanced-configuration">Advanced Configuration</h2> <p>The Homebrew installer offers various advanced configuration settings. <strong>Most users can skip this section and instead follow the instructions on the <a href="https://brew.sh">homepage</a>!</strong></p> <h3 id="git-remote-mirroring">Git Remote Mirroring</h3> <p>If you have issues connecting to GitHub.com, you can use Git mirrors for Homebrew’s installation and <code class="language-plaintext highlighter-rouge">brew update</code> by setting <code class="language-plaintext highlighter-rouge">HOMEBREW_BREW_GIT_REMOTE</code> and/or <code class="language-plaintext highlighter-rouge">HOMEBREW_CORE_GIT_REMOTE</code> in your shell environment with this script:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">export </span><span class="nv">HOMEBREW_BREW_GIT_REMOTE</span><span class="o">=</span><span class="s2">"..."</span> <span class="c"># put your Git mirror of Homebrew/brew here</span> <span class="nb">export </span><span class="nv">HOMEBREW_CORE_GIT_REMOTE</span><span class="o">=</span><span class="s2">"..."</span> <span class="c"># put your Git mirror of Homebrew/homebrew-core here</span> /bin/bash <span class="nt">-c</span> <span class="s2">"</span><span class="si">$(</span>curl <span class="nt">-fsSL</span> https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh<span class="si">)</span><span class="s2">"</span> </code></pre></div></div> <p>The default Git remote will be used if the corresponding environment variable is unset and works best for most users.</p> <p><strong>Note:</strong> if you set these variables you are granting these repositories the same level of trust you currently grant to Homebrew itself. You should be extremely confident that these repositories will not be compromised.</p> <h3 id="default-tap-cloning">Default Tap Cloning</h3> <p>You can instruct Homebrew to return to pre-4.0.0 behaviour by cloning the Homebrew/homebrew-core tap during installation by setting the <code class="language-plaintext highlighter-rouge">HOMEBREW_NO_INSTALL_FROM_API</code> environment variable with the following:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">export </span><span class="nv">HOMEBREW_NO_INSTALL_FROM_API</span><span class="o">=</span>1 /bin/bash <span class="nt">-c</span> <span class="s2">"</span><span class="si">$(</span>curl <span class="nt">-fsSL</span> https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh<span class="si">)</span><span class="s2">"</span> </code></pre></div></div> <p>This will make Homebrew install formulae and casks from the <code class="language-plaintext highlighter-rouge">homebrew/core</code> and <code class="language-plaintext highlighter-rouge">homebrew/cask</code> taps using local checkouts of these repositories instead of Homebrew’s API. Unless you are a Homebrew maintainer or contributor, you should probably not globally enable this setting. It can easily be enabled later after installation should it be necessary.</p> <h3 id="unattended-installation">Unattended installation</h3> <p>If you want a non-interactive run of the Homebrew installer that doesn’t prompt for passwords (e.g. in automation scripts), prepend <a href="https://github.com/Homebrew/install/#install-homebrew-on-macos-or-linux"><code class="language-plaintext highlighter-rouge">NONINTERACTIVE=1</code></a> to the installation command.</p> <h2 id="alternative-installs">Alternative Installs</h2> <h3 id="linux-or-windows-10-subsystem-for-linux">Linux or Windows 10 Subsystem for Linux</h3> <p>Check out <a href="/Homebrew-on-Linux">the Homebrew on Linux installation documentation</a>.</p> <h3 id="untar-anywhere-unsupported">Untar anywhere (unsupported)</h3> <p>Technically, you can just extract (or <code class="language-plaintext highlighter-rouge">git clone</code>) Homebrew wherever you want. However, you shouldn’t install outside the default, supported, best prefix. Many things will need to be built from source outside the default prefix. Building from source is slow, energy-inefficient, buggy and unsupported. The main reason Homebrew just works is <strong>because</strong> we use bottles (binary packages) and most of these require using the default prefix. If you decide to use another prefix: don’t open any issues, even if you think they are unrelated to your prefix choice. They will be closed without response.</p> <p><strong>TL;DR: pick another prefix at your peril!</strong></p> <div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">mkdir </span>homebrew <span class="o">&amp;&amp;</span> curl <span class="nt">-L</span> https://github.com/Homebrew/brew/tarball/master | <span class="nb">tar </span>xz <span class="nt">--strip-components</span> 1 <span class="nt">-C</span> homebrew </code></pre></div></div> <p>or:</p> <div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git clone https://github.com/Homebrew/brew homebrew </code></pre></div></div> <p>then:</p> <div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">eval</span> <span class="s2">"</span><span class="si">$(</span>homebrew/bin/brew shellenv<span class="si">)</span><span class="s2">"</span> brew update <span class="nt">--force</span> <span class="nt">--quiet</span> <span class="nb">chmod</span> <span class="nt">-R</span> go-w <span class="s2">"</span><span class="si">$(</span>brew <span class="nt">--prefix</span><span class="si">)</span><span class="s2">/share/zsh"</span> </code></pre></div></div> <p>Make sure you avoid installing into:</p> <ul> <li>Directories with names that contain spaces. Homebrew itself can handle spaces, but many build scripts cannot.</li> <li><code class="language-plaintext highlighter-rouge">/tmp</code> subdirectories because Homebrew gets upset.</li> <li><code class="language-plaintext highlighter-rouge">/sw</code> and <code class="language-plaintext highlighter-rouge">/opt/local</code> because build scripts get confused when Homebrew is there instead of Fink or MacPorts, respectively.</li> </ul> <h3 id="multiple-installations-unsupported">Multiple installations (unsupported)</h3> <p>Create a Homebrew installation wherever you extract the tarball. Whichever <code class="language-plaintext highlighter-rouge">brew</code> command is called is where the packages will be installed. You can use this as you see fit, e.g. to have a system set of libs in the default prefix and tweaked formulae for development in <code class="language-plaintext highlighter-rouge">~/homebrew</code>.</p> <h2 id="uninstallation">Uninstallation</h2> <p>Uninstallation is documented in the <a href="/FAQ#how-do-i-uninstall-homebrew">FAQ</a>.</p> <p><a data-proofer-ignore="" name="1"><sup>1</sup></a> For 32-bit or PPC support see <a href="https://github.com/mistydemeo/tigerbrew">Tigerbrew</a>.</p> <p><a data-proofer-ignore="" name="2"><sup>2</sup></a> macOS 13 (Ventura) or higher is best and supported, 10.11 (El Capitan) – 12 (Monterey) are unsupported but may work and 10.10 (Yosemite) and older will not run Homebrew at all. For 10.4 (Tiger) – 10.6 (Snow Leopard) see <a href="https://github.com/mistydemeo/tigerbrew">Tigerbrew</a>.</p> <p><a data-proofer-ignore="" name="3"><sup>3</sup></a> You may need to install Xcode, the CLT, or both depending on the formula, to install a bottle (binary package) which is the only supported configuration. Downloading Xcode may require an Apple Developer account on older versions of Mac OS X. Sign up for free at <a href="https://developer.apple.com/account/">Apple’s website</a>.</p> <p><a data-proofer-ignore="" name="4"><sup>4</sup></a> The one-liner installation method found on <a href="https://brew.sh">brew.sh</a> uses the Bourne-again shell at <code class="language-plaintext highlighter-rouge">/bin/bash</code>. Notably, <code class="language-plaintext highlighter-rouge">zsh</code>, <code class="language-plaintext highlighter-rouge">fish</code>, <code class="language-plaintext highlighter-rouge">tcsh</code> and <code class="language-plaintext highlighter-rouge">csh</code> will not work.</p> </div> </div> <a href="https://github.com/Homebrew/brew/edit/master/docs/Installation.md"><img id="forkme" src="/assets/img/forkme_right_gray_6d6d6d.svg" alt="Fork me on GitHub"></a> <script> function loadLanguage(lang) { if (lang === null) { return; } else if (lang === 'en') { window.location.assign('/'); } else { window.location.assign('/' + lang); } } function loadAnchors() { anchors.options = { placement: 'left', visible: 'hover', }; anchors.add('#page > h2, #page > h3, #page > h4, #page > h5, #page > h6'); }; function loadSearch(lang, site) { docsearch(Object.assign( { searchParameters: { facetFilters: ['site: ' + site] } }, { initialQuery: new URLSearchParams(window.location.search).get('search') }, { placeholder: "Search Documentation" }, {"apiKey":"e3369d62b2366b374c54b2c5a2835a00","indexName":"brew_all","appId":"D9HG3G8GS4","container":"#search-container"} )); }; let escapeHTML = (identity) => identity; if (window.trustedTypes && window.trustedTypes.createPolicy) { let policy = trustedTypes.createPolicy( "forceInner", { createHTML: (to_escape) => to_escape } ); escapeHTML = (html) => policy.createHTML(html); }; async function setupCopyables() { if (navigator.clipboard) { for (const element of document.getElementsByClassName('copyable')) { let text = element.innerText.trim(); if (text.startsWith('$')) { text = text.substr(1).trimLeft(); } const button = document.createElement('button'); button.innerHTML = escapeHTML('📋'); button.setAttribute('aria-label', 'Copy to clipboard'); button.onclick = () => { navigator.clipboard.writeText(text); button.innerHTML = escapeHTML('✅'); setTimeout(() => button.innerHTML=escapeHTML('📋'), 1000); } element.appendChild(button); } } } window.addEventListener("DOMContentLoaded", function() { setupCopyables(); }); </script> <script src="https://cdn.jsdelivr.net/npm/anchor-js@5.0.0/anchor.min.js" integrity="sha256-aQmOEF2ZD4NM/xt4hthzREIo/2PFkOX/g01WjxEV7Ys=" crossorigin="anonymous" onload="loadAnchors()" async></script> <script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3/dist/umd/index.min.js" onload="loadSearch('', 'docs')" async></script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10