Commit Graph
22 Commits
Author SHA1 Message Date
Mike McQuaid af3538d54d Add as-console-user command
- Support MDM/Munki/Jamf runs where the parent process is root but
  Homebrew must execute as the logged-in macOS console user.
- Keep the nested operation constrained to `HOMEBREW_BREW_FILE` so this
  helper cannot become a general-purpose root command launcher.
- Share `macos_user.sh` with installer scripts so no-user and package
  plist fallback behaviour cannot drift between install paths.
- Stage `macos_user.sh` for `pkgbuild` because `preinstall` needs the
  resolver before the Homebrew payload has been installed.
2026-05-20 19:35:06 +01:00
Mike McQuaid a8203e9428 Fix package API cache install
- Restore regular API cache files during package builds until
  `internal` API installs are the default.
- Merge packaged API cache contents so existing `api/internal`
  directories do not break package reinstalls.
2026-05-18 15:39:37 +01:00
Mike McQuaid d7ac00a722 pkg: disable installer Git hooks
- clear `.git/hooks` before privileged installer `git` operations
- run repository `git` calls through `git_no_hooks` to ignore
  `core.hooksPath`
- fail `release.yml` if future installer `git` calls skip that
  wrapper
2026-04-26 12:44:25 +01:00
Mike McQuaid 9421ad1399 pkg: clean Homebrew git state
- remove local Git hooks and `.gitconfig` during `.pkg` installs
- warn in `brew doctor` when the `Homebrew/brew` repo contains them
- avoid local Git customisations breaking installs or updates
2026-04-25 13:09:06 +01:00
Mike McQuaid a9faa2cd8e package/scripts/postinstall: add Homebrew to PATH.
This is automatic for `/usr/local/bin/brew` but let's do it manually
for `/opt/homebrew/bin/brew` too.
2025-06-23 15:16:49 +01:00
Eric Knibbe 78a326d832 pkg: fix existing installation not being upgraded 2025-03-04 23:42:47 -05:00
Eric Knibbe 90ac39998f pkg: adjust setting permissions on Intel 2024-06-13 17:32:38 -04:00
Ruoyu Zhong 8a0b4edd8a package/scripts/postinstall: simplify
It is safe to override `HOME` for the entire script as only Git uses it.
2024-04-11 20:37:37 +08:00
Ruoyu Zhong f76442837a package/scripts/postinstall: avoid writing to ~/.gitconfig
In this attempt we pretend that the "global" configs are in the
repository itself.

    $ XDG_CONFIG_HOME= HOME=$PWD git config --global section.key value
    $ XDG_CONFIG_HOME= HOME=$PWD git config --global section.key
    value
    $ git config --global section.key
    $ cat $PWD/.gitconfig
    [section]
      key = value
2024-04-11 04:15:59 +08:00
Ruoyu Zhong ad4a0800cc package/scripts/postinstall: handle /usr/local/Homebrew 2024-04-11 02:02:05 +08:00
Ruoyu Zhong b516fda8be package/scripts/postinstall: avoid writing to ~/.gitconfig
We can eliminate permission issues by not touching `~/.gitconfig` at
all.

Fixes #17067.
2024-04-11 01:12:03 +08:00
Ruoyu Zhong 005d76805a package/scripts/postinstall: fix permissions of opt
Fixes https://github.com/orgs/Homebrew/discussions/5052.
2024-01-15 11:19:15 +08:00
nstraussandMike McQuaid e0ac5459b3 Improve Mac package for enterprise install scenarios
- Allow specifying user through `/var/tmp/.homebrew_pkg_user.plist`
- Improve permission handling
- Correctly write API cache
- Add `preinstall` script to fail if we can't get a valid user

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2023-10-06 11:53:00 +01:00
Mike McQuaid 5c5ac49a39 More Homebrew .pkg improvements
- test on more macOS versions and improve the test names
- add a more resilient and less disruptive version of changing `git`'s
 `safe.directory` configuration
2023-10-04 18:32:08 +01:00
Mike McQuaid c95a26b917 Improve building Homebrew*.pkg
- split jobs into build/test/deploy
- test package on both macOS Intel and Apple Silicon
- cleanup some argument handling
- use `HOMEBREW_MACOS_OLDEST_SUPPORTED` naming to be consistent with
  `brew.sh`
- note in `brew.sh` that `Distribution.xml` also needs updated (and do
  so)
- various other little bits of style cleanup
2023-10-04 10:18:27 +01:00
Mike McQuaid 2b0471c122 workflows/build-pkg: actually try to install package.
- This should help avoid this regressing
- Remove existing Homebrew installation(s)
- Install it twice to ensure that installing over the top of an existing
  installation works as expected
- Remove existing API cache to ensure we have the freshest files from
  the API in our package
2023-07-27 15:51:40 +01:00
Mike McQuaid b00a95b678 pkg installer: install cached API data.
Continuing with the goals of making the installer:
- more useful
- entirely offline

Let's pre-download the API data from a `brew update` run and install it
into the logged-in user's home directory.

While we're here, in the `postinstall` script:
- use longer arguments for various commands
- fix an issue with symlinking on Intel if `/usr/local/bin` doesn't
  already exist
- unset `bash -x` and use `-v` on more commands instead
2023-07-26 15:32:14 +01:00
Mike McQuaid c5afd5d056 macOS .pkg improvements
- don't include GitHub Actions credentials
- generate and include RTF version of Homebrew BSD license
- create nicer installer with `productbuild`
- customise welcome/conclusion messages
- add Homebrew logo as a background image
- remove unnecessary `preinstall` script
- cleanup `postinstall` script to pass `brew doctor`
- use `Distribution.xml` for a nicer installer
- require CLT or Xcode rather than using our hacks to try and install
  CLT during installation
2023-07-25 15:47:34 +01:00
Sean MolenaarandGitHub 76f4826ff7 package: fix ARM name and owner of prefix 2023-02-17 17:12:36 +01:00
Sean MolenaarandSean Molenaar f30779c6bf Update package/scripts/postinstall 2022-12-23 19:36:13 +01:00
f6a9980e49 fix: cleanup macOS packaging
Don't allow specifying target
Add `set -e` to shell scripts
Don't try and package on every PR

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2022-12-21 13:18:09 +01:00
Sean Molenaar 72b3348fb1 feature: generate macOS pkg files 2022-12-19 21:26:24 +01:00