20

I deleted /nix and started a fresh install of nix, however after installing nix install nix (MACBook Pro M1 arm64 BigSur) with sh <(curl -L https://nixos.org/nix/install) I run $ nix but I get the output zsh: command not found: nix , same for nix-shellalso the /nix volume is not created, I also tried the instruction at https://docs.plutus-community.com/docs/setup/MacOS.html still same issue

1 Answer 1

34
  1. Open /etc/zshrc and look for the following lines (probably at the end of the file):

     # Nix
     if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
        . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
     fi
     # End Nix
    
  2. Copy these lines and delete them from this file.

  3. Open ~/.zshrc and add the above copied lines to the end of this file

  4. Reboot terminal and nix should work now.

5
  • 4
    I tried other solutions, and this is the only thing that worked for me.
    – james-see
    Commented May 12, 2022 at 16:17
  • 1
    This also worked for me, but after I restarted my macbook everything turned back. And this time, I already put that code into .zshrc but still can't find nix cli.
    – ShuangSong
    Commented Jul 25, 2022 at 13:20
  • 6
    It seems that upgrading macOS system will remove/reset the file /etc/zshrc that was updated by Nix during installation. Commented Mar 23, 2023 at 7:15
  • yes, what @NeoZoom.lua says, still valid. I am experiencing the same after macos update. Commented Aug 26 at 18:31
  • For me it was slightly different: I didn't have the above lines in /etc/zshrc. But copied them in my profile .zshrc like instructed. (And I still don't have them)
    – Kev
    Commented Sep 10 at 8:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.