From b77b809a9fe7697f71fc13185b2f06455af0cc82 Mon Sep 17 00:00:00 2001 From: Aman Verma Date: Sat, 4 Jan 2025 21:31:12 -0600 Subject: [PATCH 1/2] Change default temp on Linux to /var/tmp. Previously, the default temporary directory was /tmp on Linux and /private/tmp on macOS. On many Linux distros, including at least Fedora, /tmp is stored in RAM. This diverges from the behavior on macOS and has led to bugs, most notably the inability to install large bottles on memory-limited machines. This fixes #19037. --- Library/Homebrew/brew.sh | 2 +- Library/Homebrew/env_config.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 7c59fd881e8aa..1b4269b6210cb 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -65,7 +65,7 @@ else CACHE_HOME="${HOMEBREW_XDG_CACHE_HOME:-${HOME}/.cache}" HOMEBREW_DEFAULT_CACHE="${CACHE_HOME}/Homebrew" HOMEBREW_DEFAULT_LOGS="${CACHE_HOME}/Homebrew/Logs" - HOMEBREW_DEFAULT_TEMP="/tmp" + HOMEBREW_DEFAULT_TEMP="/var/tmp" fi realpath() { diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb index 44a23c4f37c48..8117df94a895b 100644 --- a/Library/Homebrew/env_config.rb +++ b/Library/Homebrew/env_config.rb @@ -457,7 +457,7 @@ module EnvConfig "different volumes, as macOS has trouble moving symlinks across volumes when the target " \ "does not yet exist. This issue typically occurs when using FileVault or custom SSD " \ "configurations.", - default_text: "macOS: `/private/tmp`, Linux: `/tmp`.", + default_text: "macOS: `/private/tmp`, Linux: `/var/tmp`.", default: HOMEBREW_DEFAULT_TEMP, }, HOMEBREW_UPDATE_TO_TAG: { From 29ee54073bf1c2ef8d756d61d57586f63f1ce89b Mon Sep 17 00:00:00 2001 From: Aman Verma Date: Sat, 4 Jan 2025 22:07:11 -0600 Subject: [PATCH 2/2] fixup! Change default temp on Linux to /var/tmp. Update man pages. --- docs/Manpage.md | 2 +- manpages/brew.1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Manpage.md b/docs/Manpage.md index eb24eec51ccb1..799cc3cf702ec 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -4102,7 +4102,7 @@ command execution e.g. `$(cat file)`. the target does not yet exist. This issue typically occurs when using FileVault or custom SSD configurations. - *Default:* macOS: `/private/tmp`, Linux: `/tmp`. + *Default:* macOS: `/private/tmp`, Linux: `/var/tmp`. `HOMEBREW_UPDATE_TO_TAG` diff --git a/manpages/brew.1 b/manpages/brew.1 index 10d08d1ce9f29..0ddbab4529fe3 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -2687,7 +2687,7 @@ If set in Homebrew\[u2019]s system\-wide environment file (\fB/etc/homebrew/brew Use this path as the temporary directory for building packages\. Changing this may be needed if your system temporary directory and Homebrew prefix are on different volumes, as macOS has trouble moving symlinks across volumes when the target does not yet exist\. This issue typically occurs when using FileVault or custom SSD configurations\. .RS .P -\fIDefault:\fP macOS: \fB/private/tmp\fP, Linux: \fB/tmp\fP\&\. +\fIDefault:\fP macOS: \fB/private/tmp\fP, Linux: \fB/var/tmp\fP\&\. .RE .TP \fBHOMEBREW_UPDATE_TO_TAG\fP