Skip to content

Instantly share code, notes, and snippets.

@angerman
Last active February 1, 2024 11:38
Show Gist options
  • Star 37 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save angerman/cbe02d814d81a8e4d4ced56b19046c19 to your computer and use it in GitHub Desktop.
Save angerman/cbe02d814d81a8e4d4ced56b19046c19 to your computer and use it in GitHub Desktop.
Installing nix on macOS BigSur

The nixos.org website suggests to use:

sh <(curl -L https://nixos.org/nix/install)

For macOS on Intel (x86_64) or Apple Silicon (arm64) based macs, we need to use

sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume

That's it!

Now we can use nix as usual:

nix build -L '(import <nixpkgs> {}).hello.overrideAttrs (_: { HELLO = "WORLD"; })'

or

nix-shell -p haskell.compiler.ghc882

should just work.

@jmchapman
Copy link

jmchapman commented Dec 8, 2020

A note on arm64: I think you need to ensure you have rosetta installed first and the installer doesn't trigger it. I tried it prior to installing anything else and it failed but after installing a browser which triggered the rosetta install this worked.

@angerman
Copy link
Author

angerman commented Dec 9, 2020

A note on arm64: I think you need to ensure you have rosetta installed first and the installer doesn't trigger it. I tried it prior to installing anything else and it failed but after installing a browser which triggered the rosetta install this worked.

Right! I wrote this for a DTK which came with Rosetta pre-installed.

 /usr/sbin/softwareupdate --install-rosetta --agree-to-license

will do the trick.

@berg-austria
Copy link

I got this error when it reached to the state of Creating a Nix store volume:

error: refusing to create Nix store volume because the boot volume is
       FileVault encrypted, but encryption-at-rest is not available.
       Manually create a volume for the store and re-run this script.
       See https://nixos.org/nix/manual/#sect-macos-installation

@paulkre
Copy link

paulkre commented Jul 14, 2021

error: refusing to create Nix store volume because the boot volume is
       FileVault encrypted, but encryption-at-rest is not available.
       Manually create a volume for the store and re-run this script.
       See https://nixos.org/nix/manual/#sect-macos-installation

I got the same error.

@yisraeldov
Copy link

I got this error when it reached to the state of Creating a Nix store volume:

error: refusing to create Nix store volume because the boot volume is
       FileVault encrypted, but encryption-at-rest is not available.
       Manually create a volume for the store and re-run this script.
       See https://nixos.org/nix/manual/#sect-macos-installation

@berg-austria @paulkre did you try doing what the message said and create a separate volume?

@paulkre
Copy link

paulkre commented Jul 15, 2021

I got it working eventually by running sudo diskutil apfs addVolume disk1 APFS 'Nix Store' -mountpoint /nix. But this really wasn't a nice installation experience. It would be great if Nix could take care of these low level operations behind the scenes because I have no idea what was happening when I ran this command.

@ddowding
Copy link

ddowding commented Sep 3, 2021

I got it working eventually by running sudo diskutil apfs addVolume disk1 APFS 'Nix Store' -mountpoint /nix. But this really wasn't a nice installation experience. It would be great if Nix could take care of these low level operations behind the scenes because I have no idea what was happening when I ran this command.

Thanks paulkre your command worked for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment