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

Nix Installer fails on macOS if /etc/bash.bashrc.backup-before-nix already exists #7215

Open
mpscholten opened this issue Oct 25, 2022 · 3 comments
Labels
feature Feature request or proposal

Comments

@mpscholten
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I've seen a couple times that the nix installer fails when a file at /etc/bash.bashrc.backup-before-nix already exists. E.g. yesterday a colleague tried to install nix, and as he had nix installed previously at that macbook he got that error saying that the nix installer cannot proceed until we delete the /etc/bash.bashrc.backup-before-nix file. After that file was deleted, we reran the installer and now got the same error but for the zshrc.backup-before-nix file.

Describe the solution you'd like
The installer should just take care of this automatically. Either ask the user what to do, or even better just automatically rename e.g. zshrc.backup-before-nix to zshrc.backup-before-nix2.

@mpscholten mpscholten added the feature Feature request or proposal label Oct 25, 2022
@abathur
Copy link
Member

abathur commented Oct 25, 2022

They'll have to follow the uninstall instructions before reinstalling it: https://nixos.org/manual/nix/stable/installation/installing-binary.html#macos

If they only tried reinstalling because nix wasn't on PATH after taking a macos update, they don't have to reinstall. The update is overwriting the shell hook, but they can just replace it. See #3616 for more.

@mpscholten
Copy link
Contributor Author

This specific case was not directly related to a macos update. It just looked like nix was not installed on that machine (likely it got broken by some macos update in the past) and we tried to run the installer.

Running the uninstaller only comes to mind when you're aware that nix is already installed.

@iFreilicht
Copy link
Contributor

One potential way of fixing this could be check whether the desired lines are already in /etc/bash and just not modifying it if that is the case.

iFreilicht added a commit to iFreilicht/nix that referenced this issue Jan 31, 2023
iFreilicht added a commit to iFreilicht/nix that referenced this issue Jan 31, 2023
iFreilicht added a commit to iFreilicht/nix that referenced this issue Jun 20, 2023
iFreilicht added a commit to iFreilicht/nix that referenced this issue Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request or proposal
Projects
None yet
Development

No branches or pull requests

3 participants