Unable to Run Nix on MacOS Montery v12.6 M1 Chip After Install

Hi All,

tldr; Nix was able to install into MacOs but is not available in my path. Attempted to reinstall but that fails and I am unsure how to get nix in my path or even access the nix runner.

I started the download process in my shell here:

$ sh <(curl -L https://nixos.org/nix/install)
  1. Download successful
  2. Y, more detail
  3. Y, continue
  4. Y, use sudo
  5. Found previous install, able to verify :
~~> Fixing any leftover Nix volume state
Before I try to install, I'll check for any existing Nix volume config
and ask for your permission to remove it (so that the installer can
start fresh). I'll also ask for permission to fix any issues I spot.

---- Found existing Nix volume -------------------------------------------------
  special:      disk3s7
     uuid:      1F371385-73FF-4054-86DC-6271A5C74750
encrypted:      yes

---- sudo execution ------------------------------------------------------------
I am executing:

    $ sudo security find-generic-password -s 1F371385-73FF-4054-86DC-6271A5C74750 -w

to confirm keychain has a password that unlocks this volume

---- sudo execution ------------------------------------------------------------
I am executing:

    $ sudo /usr/sbin/diskutil apfs unlockVolume disk3s7 -verify -stdinpassphrase -user 1F371385-73FF-4054-86DC-6271A5C74750

to confirm the password actually unlocks the volume

Verifying the specific cryptographic user 1F371385-73FF-4054-86DC-6271A5C74750 on APFS Volume disk3s7
Passphrase valid
Found a working decryption password in keychain :)
  1. then fails:
~~> Checking for artifacts of previous installs
Before I try to install, I'll check for signs Nix already is or has
been installed on this system.

---- 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

Or feel free to contact the team:
 - Matrix: #nix:nixos.org
 - IRC: in #nixos on irc.libera.chat
 - twitter: @nixos_org
 - forum: https://discourse.nixos.org

this concerns me, as a new users I am lost on how to approach this:

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.

It seems i just need to find a way to either access the nix runner or add it to my path for ZSH.

Any help would be appreciated as I am unsure on how to proceed.

This likely indicates that one of your shell init files (usually ~/.zshrc) is hard-setting the PATH and overwriting the changes made by the shell hook the installer adds at the end of /etc/zshrc.

It might also indicate that your /etc/zshrc has something custom near the top that is returning before the shell hook ever runs.

Thank you for following up with me. Is there a path export I can put into my .zshrc

I see i have /nix installed in my root / directory:

➜  /nix ls -al
total 0
drwxr-xr-x     5 root  nixbld     160 Aug 15 20:24 .
drwxr-xr-x    20 root  wheel      640 Aug 24 04:59 ..
d-wx--x--t     3 root  wheel       96 Aug 15 20:24 .Trashes
drwxrwxr-t  5074 root  nixbld  162368 Aug 15 20:46 store
drwxr-xr-x     4 root  nixbld     128 Aug 15 20:24 var

Perhaps a community member know what the correct path is for nix that I could add to my .zshrc file?

Since the installer should’ve already added the shell hook to /etc/zshrc, you can copy that one.