I have installed Nix on a Mac OSX (v 10.9.2) but anytime I try to run any command I get this message:

error: getting information about '/Users/myuser/.nix-defexpr': No such file or directory

This seems related with the absence of channels properly defined, but I don't know how to create them. Other nix installations on Gnu/Linux automatically do that and running .nix-env --update nixpkgs gives me ./nix-channel: unable to check 'https://nixos.org/channels/nixpkgs-unstable, but I can browse that address from Firefox/Brave.

BTW, login out a re-login doesn't make any nix commands available from command prompt, so I need to run them from ~/.nix-profile/bin/.

Any clue about how to solve it?

  • nix-channel --add 'https://nixos.org/channels/nixpkgs-unstable' nixpkgs ?
    – olejorgenb
    Dec 26 '16 at 6:35

This is more of a comment but an answer but I don't have enough reputation to do that. Hopefully this will suffice.

I would guess that something went funny with your installation of nix:

  • .nix-defexpr dir is the locations of the expressions you download from a channel. So if that's missing then you won't get much joy.
  • .nix-profile/bin: iirc there's a small shell script that gets sourced from your .bash-profile and adds .nix-profile to your $PATH. That also should get added to .bash-profile at installation.

If it's feasible for you to simply reinstall nix using the nix install script curl https://nixos.org/nix/install | sh (link) that should be the easiest option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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