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 can't backup "/etc/bashrc" to "/etc/bashrc.backup-before-nix" and I do not know how to remove the backup to allow Nix to install #9855

Open
g-evan-c opened this issue Jan 26, 2024 · 1 comment

Comments

@g-evan-c
Copy link

Platform

macOS M3 Pro

Additional information

I have installed Nix before, to install PianoTrans (https://github.com/azuwis/pianotrans) and it worked successfully. However today, I could not launch pianotrans, and whenever I tried to run a Nix command, the terminal did not seem to recognise the command. So I tried to reinstall Nix. It gave me this error and did not show me how to access "/etc/bashrc" or "/etc/bashrc.backup-before-nix" which is why I am now creating this post on the issue. It is likely the "backup before nix" file/folder would have contained my old installation of Nix should the installation have continued which isn't supposed to happen. If anyone knows how to help, that would be greatly appreciated!

Output

Output

---- oh no! --------------------------------------------------------------------
I back up shell profile/rc scripts before I add Nix to them.
I need to back up /etc/bashrc to /etc/bashrc.backup-before-nix,
but the latter already exists.

Here's how to clean up the old backup file:

1. Back up (copy) /etc/bashrc and /etc/bashrc.backup-before-nix
   to another location, just in case.

2. Ensure /etc/bashrc.backup-before-nix does not have anything
   Nix-related in it. If it does, something is probably quite
   wrong. Please open an issue or get in touch immediately.

3. Once you confirm /etc/bashrc is backed up and
   /etc/bashrc.backup-before-nix doesn't mention Nix, run:
   mv /etc/bashrc.backup-before-nix /etc/bashrc

We'd love to help if you need it.

You can open an issue at
https://github.com/NixOS/nix/issues/new?labels=installer&template=installer.md

Or get in touch with the community: https://nixos.org/community


Priorities

Add 👍 to issues you find important.

@abathur
Copy link
Member

abathur commented Jan 26, 2024

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

For future reference: since you were reinstalling because Nix was missing from your PATH after a macOS update, you don't have to reinstall to fix this. The macOS update is overwriting the shell hook, but you can just replace it. See #3616 for more.

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