Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS installer fails if GNU utilities precede MacOS on PATH #11570

Open
1 of 3 tasks
n8henrie opened this issue Sep 23, 2024 · 3 comments
Open
1 of 3 tasks

MacOS installer fails if GNU utilities precede MacOS on PATH #11570

n8henrie opened this issue Sep 23, 2024 · 3 comments

Comments

@n8henrie
Copy link
Contributor

n8henrie commented Sep 23, 2024

Platform

  • Linux:
  • macOS
  • WSL

Additional information

Reinstall of an existing multi-user nix installation (to deal with nixbld issues on MacOS 15 Sequoia): #10892 starting an issue as suggested in that thread.

$ sw_vers 
ProductName:		macOS
ProductVersion:		15.0
BuildVersion:		24A335
$ type -a tar
tar is /etc/profiles/per-user/n8henrie/bin/tar
tar is /run/current-system/sw/bin/tar
tar is /usr/bin/tar

Workaround: PATH=$(getconf PATH) sh <(curl -L https://nixos.org/nix/install)

Output

$ sh <(curl -L https://nixos.org/nix/install)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  4267  100  4267    0     0  10441      0 --:--:-- --:--:-- --:--:--     0
downloading Nix 2.24.7 binary tarball for aarch64-darwin from 'https://releases.nixos.org/nix/nix-2.24.7/nix-2.24.7-aarch64-darwin.tar.xz' to '/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/nix-binary-tarball-unpack.nJf7SW58hu'...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 14.6M  100 14.6M    0     0  18.8M      0 --:--:-- --:--:-- --:--:-- 18.8M
tar (child): xz: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
/dev/fd/63: failed to unpack 'https://releases.nixos.org/nix/nix-2.24.7/nix-2.24.7-aarch64-darwin.tar.xz'

Priorities

Add 👍 to issues you find important.

@n8henrie
Copy link
Contributor Author

Perhaps something like:

require_util tar "unpack the binary tarball"
- if [ "$(uname -s)" != "Darwin" ]; then
+ if [ "$(uname -s)" != "Darwin" ] || [ "$(command -v tar)" != /usr/bin/tar ]; then
    require_util xz "unpack the binary tarball"
fi

(or an explicit if Darwin && command -f tar / else if that's considered more readable.)

@abathur
Copy link
Member

abathur commented Sep 23, 2024

Context from other thread: It sounds like there was a previous attempt to address this, but I guess it was only a partial fix:

Perhaps something like:
...

I was imagining we could just use /usr/bin/tar when running on macOS (the other threads linked above discuss some reasons that it may not be ideal to send prospective users on a "just install xz" quest)

@n8henrie
Copy link
Contributor Author

Alternatively, we could fix this and prevent similar surprises with other tools down the line by cleaning / exporting PATH early in the script (only on Darwin). That would help prevent issues with tools on the PATH from nix, homebrew, macports, etc.

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

No branches or pull requests

2 participants