NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.8k stars 1.52k forks source link

Installation error on MacOS Montery (CPU: Apple M1 Max): cp: cannot overwrite directory /nix/store/ #6670

Open jcrites opened 2 years ago

jcrites commented 2 years ago

Describe the bug

Steps To Reproduce

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

The Nix installation script fails. Representative failures:

~~> Installing Nix

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

    $ sudo cp -RPp ./store/1brkxcs287n1px2i4fq39l7h51hjv0f8-nix-2.9.1 ./store/1dr4qyknp1n7s6b23bx7pf7afqq7w9kn-nss-cacert-3.66 ./store/2c3vg12f9vmc1kfb7r6n5c1li9lkgcq3-libsodium-1.0.18 ./store/3l83x42cfix2bziry2db6f2shpisnr4i-libkrb5-1.18 ./store/3w55v66x994ngdxdj37m81biv6v8kiyg-aws-c-event-stream-0.2.7 ./store/4lbw9nfz4yrbpdljl590dh09d7h078xg-xz-5.2.5 ./store/65clrki5hh8qyqhmw7f50hzngxylnxsb-apple-framework-IOKit-11.0.0 ./store/6wp2rfk7rx9fdmf6fqjinzg46apa4n41-nghttp2-1.43.0-lib ./store/7imgx23awids8vh7s0j73z860d9494j0-editline-1.17.1 ./store/846mnj600p3r7lk37m41hpb8lq9nq2kk-apple-lib-libDER ./store/8jn6kyk6l29r1aji5vi6bxs4wnpzy3aq-zlib-1.2.11 ./store/9r87bnfja2inm6hhb1h9x220rzmxx9js-bzip2-1.0.6.0.2 ./store/alz5nj8xwsda53y907bs2apvrcs9ihqw-boehm-gc-8.0.4 ./store/drnnv1km6bmfhbli803q7m33rphqwh00-bash-4.4-p23 ./store/g70l5m3qgwjfyycjjb5x1j3x75s252n5-sqlite-3.35.5 ./store/gpmfni7fs8hfhcj3aa753k2shi8ya2jb-libxml2-2.9.12 ./store/hr1g9ndsjllyk9wxiyp2d3jaiclvc34p-apple-framework-Security-11.0.0 ./store/ijyg31dz04k6cmvlnfn7v1q0dc7pqj2i-curl-7.76.1 ./store/k3qrnp28vgfq3lyv7vqy1612m1hbrfhf-aws-c-common-0.5.5 ./store/k77xbzbf11y3g99x5xmrdpyi2s1b8vrx-libssh2-1.9.0 ./store/kwjz68ij61yyg4lh2hl96lhdil1aj095-aws-c-cal-0.4.5 ./store/lnbyfs85fmllr4fm11gdaf1gf19nvpbb-libarchive-3.5.2-lib ./store/m6rz9cz2dd0xh0m2wbbqaf13y1fipcdb-apple-framework-CoreFoundation-11.0.0 ./store/nhhp56dld1jmg9xlscfm0p4qpsvkmk06-aws-sdk-cpp-1.8.121 ./store/njiasqwn50ffwi913misf1mdg7j5bfrq-brotli-1.0.9-lib ./store/pwpdd5r7dy2r1br639lgnnnhlzrnacya-libobjc-11.0.0 ./store/qvjyzishpapl60plh3anxbg2hnqxj9xh-zstd-1.4.9 ./store/r4bhv91n3zh4ac55vpcdgpv6gk26cfgj-libcxxabi-11.1.0 ./store/rj74h8dbrmfvrppgyj2p76azcpwic438-aws-c-io-0.9.1 ./store/sckpsqqpf1k6jsqs2xgjzy3xzqisr6lv-nlohmann_json-3.9.1 ./store/synk9411f4whmzfqpmg8fq0jamgiv4zh-libiconv-50 ./store/w3ygxknpx1hsf2wapsqg5ka7hq75qs2p-openssl-1.1.1l ./store/yybs8szwh5n40nvy96d1a23mfrc019pz-libcxx-11.1.0 ./store/z8z1ihqh918rj0xb09c8mygicdsh3l1j-aws-checksums-0.1.11 /nix/store/

to copy the basic Nix files to the new store at /nix/store

cp: cannot overwrite directory /nix/store/3l83x42cfix2bziry2db6f2shpisnr4i-libkrb5-1.18/sbin with non-directory ./store/3l83x42cfix2bziry2db6f2shpisnr4i-libkrb5-1.18/sbin
cp: cannot overwrite directory /nix/store/65clrki5hh8qyqhmw7f50hzngxylnxsb-apple-framework-IOKit-11.0.0/Library/Frameworks/IOKit.framework/Versions/Current with non-directory ./store/65clrki5hh8qyqhmw7f50hzngxylnxsb-apple-framework-IOKit-11.0.0/Library/Frameworks/IOKit.framework/Versions/Current

Full Installation Record

➜  ~ sh <(curl -L https://nixos.org/nix/install)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  4053  100  4053    0     0   9435      0 --:--:-- --:--:-- --:--:--  9435
downloading Nix 2.9.1 binary tarball for aarch64-darwin from 'https://releases.nixos.org/nix/nix-2.9.1/nix-2.9.1-aarch64-darwin.tar.xz' to '/var/folders/7w/rynd9nt95y354kxspwkx4cfr0000gp/T/nix-binary-tarball-unpack.XXXXXXXXXX.y5TYrQrx'...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 9172k  100 9172k    0     0  9834k      0 --:--:-- --:--:-- --:--:-- 9927k
Switching to the Multi-user Installer
Welcome to the Multi-User Nix Installation

This installation tool will set up your computer with the Nix package
manager. This will happen in a few stages:

1. Make sure your computer doesn't already have Nix. If it does, I
   will show you instructions on how to clean up your old install.

2. Show you what I am going to install and where. Then I will ask
   if you are ready to continue.

3. Create the system users and groups that the Nix daemon uses to run
   builds.

4. Perform the basic installation of the Nix files daemon.

5. Configure your shell to import special Nix Profile files, so you
   can use Nix.

6. Start the Nix daemon.

Would you like to see a more detailed list of what I will do?
[y/n] n

---- let's talk about sudo -----------------------------------------------------
This script is going to call sudo a lot. Every time I do, it'll
output exactly what it'll do, and why.

Just like this:

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

    $ sudo echo

to demonstrate how our sudo prompts look

This might look scary, but everything can be undone by running just a
few commands. I used to ask you to confirm each time sudo ran, but it
was too many times. Instead, I'll just ask you this one time:

Can I use sudo?
[y/n] y

Yay! Thanks! Let's get going!

~~> 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:  686FA450-00CF-47E4-8B7F-E4F84C00B2EC
encrypted:  yes

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

    $ sudo security find-generic-password -s 686FA450-00CF-47E4-8B7F-E4F84C00B2EC -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 686FA450-00CF-47E4-8B7F-E4F84C00B2EC

to confirm the password actually unlocks the volume

Verifying the specific cryptographic user 686FA450-00CF-47E4-8B7F-E4F84C00B2EC on APFS Volume disk3s7
Passphrase valid
Found a working decryption password in keychain :)

During install, I add 'nix' to /etc/synthetic.conf, which instructs
macOS to create an empty root directory for mounting the Nix volume.
Can I remove /etc/synthetic.conf?
[y/n] y

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

    $ sudo rm /etc/synthetic.conf

to remove /etc/synthetic.conf

During install, I add '/nix' to /etc/fstab so that macOS knows what
mount options to use for the Nix volume.
Can I remove /etc/fstab?
[y/n] y

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

    $ sudo rm /etc/fstab

to remove /etc/fstab

The installer adds a LaunchDaemon to mount your Nix volume: org.nixos.darwin-store
Can I remove it?
[y/n] y

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

    $ sudo launchctl bootout system/org.nixos.darwin-store

to terminate the daemon

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

    $ sudo rm /Library/LaunchDaemons/org.nixos.darwin-store.plist

to remove the daemon definition

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

---- Nix config report ---------------------------------------------------------
        Temp Dir:   /var/folders/7w/rynd9nt95y354kxspwkx4cfr0000gp/T/tmp.vOSfzPV2VO
        Nix Root:   /nix
     Build Users:   32
  Build Group ID:   30000
Build Group Name:   nixbld

build users:
    Username:   UID
     _nixbld1:  301
     _nixbld2:  302
     _nixbld3:  303
     _nixbld4:  304
     _nixbld5:  305
     _nixbld6:  306
     _nixbld7:  307
     _nixbld8:  308
     _nixbld9:  309
     _nixbld10: 310
     _nixbld11: 311
     _nixbld12: 312
     _nixbld13: 313
     _nixbld14: 314
     _nixbld15: 315
     _nixbld16: 316
     _nixbld17: 317
     _nixbld18: 318
     _nixbld19: 319
     _nixbld20: 320
     _nixbld21: 321
     _nixbld22: 322
     _nixbld23: 323
     _nixbld24: 324
     _nixbld25: 325
     _nixbld26: 326
     _nixbld27: 327
     _nixbld28: 328
     _nixbld29: 329
     _nixbld30: 330
     _nixbld31: 331
     _nixbld32: 332

Ready to continue?
[y/n] y

---- Preparing a Nix volume ----------------------------------------------------
    Nix traditionally stores its data in the root directory /nix, but
    macOS now (starting in 10.15 Catalina) has a read-only root directory.
    To support Nix, I will create a volume and configure macOS to mount it
    at /nix.

~~> Configuring /etc/synthetic.conf to make a mount-point at /nix

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

    $ sudo /usr/bin/ex -u NONE /etc/synthetic.conf

to add Nix to /etc/synthetic.conf

~~> Creating a Nix volume

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

    $ sudo /usr/sbin/diskutil unmount force disk3s7

to ensure the Nix volume is not mounted

Volume Nix Store on disk3s7 force-unmounted

~~> Configuring /etc/fstab to specify volume mount options

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

    $ sudo /usr/sbin/vifs

to add nix to fstab

~~> Configuring LaunchDaemon to mount 'Nix Store'

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

    $ sudo /usr/bin/ex -u NONE /Library/LaunchDaemons/org.nixos.darwin-store.plist

to install the Nix volume mounter

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

    $ sudo launchctl bootstrap system /Library/LaunchDaemons/org.nixos.darwin-store.plist

to launch the Nix volume mounter

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

    $ sudo launchctl kickstart -k system/org.nixos.darwin-store

to launch the Nix volume mounter

~~> Setting up the build group nixbld
            Exists: Yes

~~> Setting up the build user _nixbld1
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 1
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld2
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 2
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld3
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 3
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld4
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 4
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld5
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 5
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld6
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 6
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld7
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 7
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld8
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 8
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld9
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 9
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld10
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 10
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld11
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 11
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld12
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 12
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld13
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 13
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld14
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 14
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld15
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 15
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld16
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 16
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld17
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 17
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld18
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 18
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld19
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 19
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld20
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 20
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld21
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 21
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld22
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 22
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld23
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 23
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld24
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 24
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld25
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 25
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld26
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 26
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld27
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 27
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld28
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 28
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld29
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 29
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld30
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 30
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld31
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 31
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the build user _nixbld32
            Exists: Yes
            Hidden: Yes
    Home Directory: /var/empty
              Note: Nix build user 32
   Logins Disabled: Yes
  Member of nixbld: Yes
    PrimaryGroupID: 30000

~~> Setting up the basic directory structure

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

    $ sudo /usr/sbin/chown -R root:nixbld /nix

to take root ownership of existing Nix store files

chown: /nix/.Trashes: Operation not permitted
chown: /nix/.Trashes: Operation not permitted

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

    $ sudo install -dv -m 0755 /nix /nix/var /nix/var/log /nix/var/log/nix /nix/var/log/nix/drvs /nix/var/nix /nix/var/nix/db /nix/var/nix/gcroots /nix/var/nix/profiles /nix/var/nix/temproots /nix/var/nix/userpool /nix/var/nix/daemon-socket /nix/var/nix/gcroots/per-user /nix/var/nix/profiles/per-user

to make the basic directory structure of Nix (part 1)

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

    $ sudo install -dv -g nixbld -m 1775 /nix/store

to make the basic directory structure of Nix (part 2)

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

    $ sudo install -dv -m 0555 /etc/nix

to place the default nix daemon configuration (part 1)

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

    $ sudo install -m 0664 /var/folders/7w/rynd9nt95y354kxspwkx4cfr0000gp/T/tmp.vOSfzPV2VO/.nix-channels /var/root/.nix-channels

to set up the default system channel (part 1)

~~> Installing Nix

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

    $ sudo cp -RPp ./store/1brkxcs287n1px2i4fq39l7h51hjv0f8-nix-2.9.1 ./store/1dr4qyknp1n7s6b23bx7pf7afqq7w9kn-nss-cacert-3.66 ./store/2c3vg12f9vmc1kfb7r6n5c1li9lkgcq3-libsodium-1.0.18 ./store/3l83x42cfix2bziry2db6f2shpisnr4i-libkrb5-1.18 ./store/3w55v66x994ngdxdj37m81biv6v8kiyg-aws-c-event-stream-0.2.7 ./store/4lbw9nfz4yrbpdljl590dh09d7h078xg-xz-5.2.5 ./store/65clrki5hh8qyqhmw7f50hzngxylnxsb-apple-framework-IOKit-11.0.0 ./store/6wp2rfk7rx9fdmf6fqjinzg46apa4n41-nghttp2-1.43.0-lib ./store/7imgx23awids8vh7s0j73z860d9494j0-editline-1.17.1 ./store/846mnj600p3r7lk37m41hpb8lq9nq2kk-apple-lib-libDER ./store/8jn6kyk6l29r1aji5vi6bxs4wnpzy3aq-zlib-1.2.11 ./store/9r87bnfja2inm6hhb1h9x220rzmxx9js-bzip2-1.0.6.0.2 ./store/alz5nj8xwsda53y907bs2apvrcs9ihqw-boehm-gc-8.0.4 ./store/drnnv1km6bmfhbli803q7m33rphqwh00-bash-4.4-p23 ./store/g70l5m3qgwjfyycjjb5x1j3x75s252n5-sqlite-3.35.5 ./store/gpmfni7fs8hfhcj3aa753k2shi8ya2jb-libxml2-2.9.12 ./store/hr1g9ndsjllyk9wxiyp2d3jaiclvc34p-apple-framework-Security-11.0.0 ./store/ijyg31dz04k6cmvlnfn7v1q0dc7pqj2i-curl-7.76.1 ./store/k3qrnp28vgfq3lyv7vqy1612m1hbrfhf-aws-c-common-0.5.5 ./store/k77xbzbf11y3g99x5xmrdpyi2s1b8vrx-libssh2-1.9.0 ./store/kwjz68ij61yyg4lh2hl96lhdil1aj095-aws-c-cal-0.4.5 ./store/lnbyfs85fmllr4fm11gdaf1gf19nvpbb-libarchive-3.5.2-lib ./store/m6rz9cz2dd0xh0m2wbbqaf13y1fipcdb-apple-framework-CoreFoundation-11.0.0 ./store/nhhp56dld1jmg9xlscfm0p4qpsvkmk06-aws-sdk-cpp-1.8.121 ./store/njiasqwn50ffwi913misf1mdg7j5bfrq-brotli-1.0.9-lib ./store/pwpdd5r7dy2r1br639lgnnnhlzrnacya-libobjc-11.0.0 ./store/qvjyzishpapl60plh3anxbg2hnqxj9xh-zstd-1.4.9 ./store/r4bhv91n3zh4ac55vpcdgpv6gk26cfgj-libcxxabi-11.1.0 ./store/rj74h8dbrmfvrppgyj2p76azcpwic438-aws-c-io-0.9.1 ./store/sckpsqqpf1k6jsqs2xgjzy3xzqisr6lv-nlohmann_json-3.9.1 ./store/synk9411f4whmzfqpmg8fq0jamgiv4zh-libiconv-50 ./store/w3ygxknpx1hsf2wapsqg5ka7hq75qs2p-openssl-1.1.1l ./store/yybs8szwh5n40nvy96d1a23mfrc019pz-libcxx-11.1.0 ./store/z8z1ihqh918rj0xb09c8mygicdsh3l1j-aws-checksums-0.1.11 /nix/store/

to copy the basic Nix files to the new store at /nix/store

cp: cannot overwrite directory /nix/store/3l83x42cfix2bziry2db6f2shpisnr4i-libkrb5-1.18/sbin with non-directory ./store/3l83x42cfix2bziry2db6f2shpisnr4i-libkrb5-1.18/sbin
cp: cannot overwrite directory /nix/store/65clrki5hh8qyqhmw7f50hzngxylnxsb-apple-framework-IOKit-11.0.0/Library/Frameworks/IOKit.framework/Versions/Current with non-directory ./store/65clrki5hh8qyqhmw7f50hzngxylnxsb-apple-framework-IOKit-11.0.0/Library/Frameworks/IOKit.framework/Versions/Current
cp: cannot overwrite directory /nix/store/65clrki5hh8qyqhmw7f50hzngxylnxsb-apple-framework-IOKit-11.0.0/Library/Frameworks/IOKit.framework/Headers with non-directory ./store/65clrki5hh8qyqhmw7f50hzngxylnxsb-apple-framework-IOKit-11.0.0/Library/Frameworks/IOKit.framework/Headers
cp: cannot overwrite directory /nix/store/65clrki5hh8qyqhmw7f50hzngxylnxsb-apple-framework-IOKit-11.0.0/Library/Frameworks/IOKit.framework/Modules with non-directory ./store/65clrki5hh8qyqhmw7f50hzngxylnxsb-apple-framework-IOKit-11.0.0/Library/Frameworks/IOKit.framework/Modules
cp: cannot overwrite directory /nix/store/hr1g9ndsjllyk9wxiyp2d3jaiclvc34p-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Versions/Current with non-directory ./store/hr1g9ndsjllyk9wxiyp2d3jaiclvc34p-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Versions/Current
cp: cannot overwrite directory /nix/store/hr1g9ndsjllyk9wxiyp2d3jaiclvc34p-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers with non-directory ./store/hr1g9ndsjllyk9wxiyp2d3jaiclvc34p-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers
cp: cannot overwrite directory /nix/store/hr1g9ndsjllyk9wxiyp2d3jaiclvc34p-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Modules with non-directory ./store/hr1g9ndsjllyk9wxiyp2d3jaiclvc34p-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Modules
cp: cannot overwrite directory /nix/store/m6rz9cz2dd0xh0m2wbbqaf13y1fipcdb-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/Versions/Current with non-directory ./store/m6rz9cz2dd0xh0m2wbbqaf13y1fipcdb-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/Versions/Current
cp: cannot overwrite directory /nix/store/m6rz9cz2dd0xh0m2wbbqaf13y1fipcdb-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/Headers with non-directory ./store/m6rz9cz2dd0xh0m2wbbqaf13y1fipcdb-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/Headers
cp: cannot overwrite directory /nix/store/m6rz9cz2dd0xh0m2wbbqaf13y1fipcdb-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/Modules with non-directory ./store/m6rz9cz2dd0xh0m2wbbqaf13y1fipcdb-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/Modules

---- oh no! --------------------------------------------------------------------
Jeeze, something went wrong. If you can take all the output and open
an issue, we'd love to fix the problem so nobody else has this issue.

:(

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
abathur commented 2 years ago

If you're seeing this error you've presumably already got a Nix Store volume from a previous install. A previous change to drop an install-dependency on rsync (#5150) has made this step non-idempotent for now.

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

For future reference: if you use zsh and you're just in this situation because nix commands disappeared from your PATH after a macOS update, you're running into #3616 and don't need to reinstall Nix--you just need to restore the shell hook to /etc/zshrc after the update.

cgifkonrad commented 2 years ago

I had that same issue trying to install Nix on version 2.11.0 The installation crashed on the same point.

Yet I found an interim solution: On my other Mac (Macbook Air) I had installed Nix in version 2.10.3 which worked flawlessly. On the second try installing nix on the Mac Book Pro I tried it by using specifically that version and it finally worked.

You can find these versions here: https://releases.nixos.org/?prefix=nix/nix-2.10.3/

After that just run sudo nix upgrade-nix to upgrade to the newest version (which is 2.11.0 at this time).

daiyam commented 2 years ago

I have the same issue when I've tried to re-install nix after it went missing...

Edit: I was able to re-install after uninstalling it as suggested by https://github.com/NixOS/nix/issues/7013#issuecomment-1239701234

ameuret commented 1 year ago

Google led me here after experiencing: cp: cannot create regular file '/nix/store/3wqasl97rjiza3vd7fxjnvli2w9l30mk-nix-2.17.0/bin/nix': Text file busy because I tried to run the installer on a preexisting installation. Despite the installer's assurance that it's going to be extra careful, it panics just because Nix is already there?

What about:

  1. Make sure your computer doesn't already have Nix. If it does, I will show you instructions on how to clean up your old install.

?

 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.41-1-MANJARO, Manjaro Linux, noversion, rolling`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.17.0`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

I ended up cleaning up after it by using https://nixos.org/manual/nix/stable/installation/uninstall.