user6938: MacOS Monterey, Apple M1
Installed latest GHC via https://www.haskell.org/ghcup/ but not Stack.
Installed nix 2.8.0 multiuser
Set Cache in /etc/nix/nix.conf as below:
UPDATE: I have since updated nix.conf file for M1. See bottom of question for latest nix.conf and corresponding error message
             sandbox = false
             substituters        = https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/
             trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=

Steps to reproduce:
git clone https://github.com/input-output-hk/plutus-starter

cd plutus-starter

nix-shell

Result: Note see Update below. This might have been due to nix.conf not setup properly for M1.
       > Configuring mtl-2.2.2...
   > "/nix/store/jjjbvzpal4b7n6hmnychrq07w36jnzjw-ghc-8.10.7/bin/ghc-pkg" update -v0 --force --package-db=libraries/bootstrapping.conf libraries/mtl/dist-boot/inplace-pkg-config
   > "inplace/bin/ghc-cabal" configure libraries/hpc dist-boot --with-ghc="/nix/store/jjjbvzpal4b7n6hmnychrq07w36jnzjw-ghc-8.10.7/bin/ghc" --with-ghc-pkg="/nix/store/jjjbvzpal4b7n6hmnychrq07w36jnzjw-ghc-8.10.7/bin/ghc-pkg"  --package-db=/private/tmp/nix-build-ghc-8.8.4.drv-1/ghc-8.8.4-configured-src/libraries/bootstrapping.conf --disable-library-for-ghci --enable-library-vanilla --enable-library-for-ghci --disable-library-profiling --disable-shared --with-hscolour="/nix/store/v35zbnmxnxh1axccw5agmplam8nbr0b8-hscolour-exe-HsColour-1.24.4/bin/HsColour" --configure-option=CFLAGS="-Wall    -Wno-unknown-pragmas" --configure-option=LDFLAGS="  " --configure-option=CPPFLAGS="   " --gcc-options="-Wall    -Wno-unknown-pragmas   " --configure-option=--with-iconv-includes="/nix/store/cg81y8mlrvd3crly089xy6xd63nvzm4w-libiconv-50/include" --configure-option=--with-iconv-libraries="/nix/store/cg81y8mlrvd3crly089xy6xd63nvzm4w-libiconv-50/lib" --configure-option=--with-gmp-includes="/nix/store/nwfxg1dpzpkq9w2awp4zs5jawn4fvyb0-gmp-6.2.1-dev/include" --configure-option=--with-gmp-libraries="/nix/store/j75k7na64g7xly1gxrkz44sby1gdc0sa-gmp-6.2.1/lib" --configure-option=--with-curses-libraries="/nix/store/bs7hpi27xc0y2qynvx4n1zpnv3s5bnkx-ncurses-6.2/lib"   --constraint "binary == 0.8.7.0"   --constraint "transformers == 0.5.6.2"   --constraint "mtl == 2.2.2"   --constraint "hpc == 0.6.0.3"   --constraint "ghc-boot-th == 8.8.4"   --constraint "ghc-boot == 8.8.4"   --constraint "template-haskell == 2.15.0.0"   --constraint "text == 1.2.4.0"   --constraint "parsec == 3.1.14.0"   --constraint "Cabal == 3.0.1.0"   --constraint "ghc-heap == 8.8.4"   --constraint "ghci == 8.8.4"   --constraint "terminfo == 0.4.1.4" --with-gcc="clang" --with-ld="ld" --with-ar="ar" --with-alex="/nix/store/x1qgmqksr03kvdslwakbn4qbi4f5h3bs-alex-exe-alex-3.2.4/bin/alex" --with-happy="/nix/store/ic7q31ff5n34k0x1x1xm8jldzh88c58s-happy-exe-happy-1.19.12/bin/happy"
   > Configuring hpc-0.6.0.3...
   > ghc-cabal: Encountered missing or private dependencies:
   > base >=4.4.1 && <4.14
   >
   > libraries/hpc/ghc.mk:3: libraries/hpc/dist-boot/package-data.mk: No such file or directory
   > make[1]: *** [libraries/hpc/ghc.mk:3: libraries/hpc/dist-boot/package-data.mk]        Error 1
   > make: *** [Makefile:124: all] Error 2
   For full logs, run 'nix log /nix/store/40hp5wypw0djadrrcb1346hk2y0ridf2-ghc-8.8.4.drv'.
    error: 1 dependencies of derivation '/nix/store/qgyzqd5v4yn32fgns4vqwcr3qrqgy8ii-ghc-8.10.4.20210212-configured-src.drv' failed to build
    error: 1 dependencies of derivation '/nix/store/3i1f6vn82wg07dwvr24dm26l45jzx3sw-ghc-8.10.4.20210212.drv' failed to build
    error: 1 dependencies of derivation '/nix/store/irws4cdrncz0gdg5m68blqj3h0p86ivx-Cabal-lib-Cabal-3.4.1.0-config.drv' failed to build
    error: 1 dependencies of derivation '/nix/store/xrwzqagrirvim8bs8kpiqxikqf78qn30-Cabal-lib-Cabal-3.6.2.0-config.drv' failed to build

Also earlier in the nix-shell log I saw the following:
    [217 of 285] Compiling Distribution.Simple.Program.GHC ( libraries/Cabal/Cabal/Distribution/Simple/Program/GHC.hs, bootstrapping/Distribution/Simple/Program/GHC.o )
    'apple-a7' is not a recognized processor for this target (ignoring processor)

Things I have tried:
Search for all nix.conf file and add the cache entries as above.
run as root: sudo nix-shell
sudo nix-build etc.
I am not familiar with nix and I might have missed some steps to be done prior to running nix-shell
PS. Also would like to clean the nix caches? So I can try again with clean cache. Is it the following?
  rm $HOME/.cache/nix/binary-cache-v*.sqlite*

or is there a nix command for this?
And the nix log command for further details did not work either:
  nix log /nix/store/40hp5wypw0djadrrcb1346hk2y0ridf2-ghc-8.8.4.drv
  error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override

using --extra-experimental-features indicates log is not recognized nix command.
UPDATE: Per suggestion I have updated the nix.conf per https://github.com/renzwo/cardano-plutus-apps-install-m1/blob/main/README.md
And my exact nix.conf file is now:
 sandbox = false
 system = x86_64-darwin
 extra-platforms = x86_64-darwin aarch64-darwin
 experimental-features = nix-command
 extra-experimental-features = flakes
 extra-sandbox-paths = /System/Library/Frameworks /System/Library/PrivateFrameworks /usr/lib /private/tmp /private/var/tmp /usr/bin/env
 substituters        = https://hydra.iohk.io   https://iohk.cachix.org https://cache.nixos.org/
 trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=

However, I now see a different error message:
 copying path '/nix/store/v3bzn8kiwxaip81hbdv9q3jhkxcmqrhk-git-2.32.0' from 'https://hydra.iohk.io'...
 building '/nix/store/zcv0q6cmd39zr580w9sq0z1wbkak0mqk-git-ls-files.drv'...

 ErrorErrorxexecuting '/nix/store/715y5lnw12vdcc3hh9sc9vbkdi6c83x6-bash-4.4-p23/bin/bash': Bad file descriptor
 error (ignored): error: end of string reached
 error: builder for '/nix/store/zcv0q6cmd39zr580w9sq0z1wbkak0mqk-git-ls-files.drv' failed with exit code 1;
   last 2 log lines:
   > 
   > ErrorErrorxexecuting '/nix/store/715y5lnw12vdcc3hh9sc9vbkdi6c83x6-bash-4.4-p23/bin/bash': Bad file descriptor
   For full logs, run 'nix log /nix/store/zcv0q6cmd39zr580w9sq0z1wbkak0mqk-git-ls-files.drv'.
 (use '--show-trace' to show detailed location information)

I see this running under both both bash and zsh shells
Here is full trace:
 sudo nix-shell --show-trace
 building '/nix/store/zcv0q6cmd39zr580w9sq0z1wbkak0mqk-git-ls- files.drv'...

 ErrorErrorxexecuting '/nix/store/715y5lnw12vdcc3hh9sc9vbkdi6c83x6-bash-4.4-p23/bin/bash': Bad file descriptor
 error: builder for '/nix/store/zcv0q6cmd39zr580w9sq0z1wbkak0mqk-git-ls-files.drv'   failed with exit code 1

   … while realising the context of path '/nix/store/g0769lx8bm7lna4gsdchiayk6n7gdcx5-git-ls-files/files'

   at /nix/store/bvynxhgsxhp6ds11ak1wnjx5h8avmfwf-source/lib/clean-git.nix:146:26:

      145|           submoduleDirs = lines (readFile (files + "/submoduleDirs"));
      146|           files = lines (readFile (files + "/files"));
         |                          ^
      147|         };

   … while evaluating 'lines'

   at /nix/store/bvynxhgsxhp6ds11ak1wnjx5h8avmfwf-source/lib/clean-git.nix:33:11:


user1108: The following git repo has the latest information on setting up your environment in Mac M1. I personally followed this tutorial and worked perfectly. I suggest you delete everything you have done before and start from scratch following this link. https://github.com/renzwo/cardano-plutus-apps-install-m1/blob/main/README.md

6938: <p>MacOS Monterey, Apple M1<br />
Installed latest GHC via <a href="https://www.haskell.org/ghcup/" rel="nofollow noreferrer">https://www.haskell.org/ghcup/</a> but not Stack.</p>
<p>Installed nix 2.8.0 multiuser
Set Cache in /etc/nix/nix.conf as below:
UPDATE: I have since updated nix.conf file for M1. See bottom of question for latest nix.conf and corresponding error message</p>
<pre><code>             sandbox = false
             substituters        = https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/
             trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
</code></pre>
<p>Steps to reproduce:</p>
<pre><code>git clone https://github.com/input-output-hk/plutus-starter

cd plutus-starter

nix-shell
</code></pre>
<p>Result: Note see Update below. This might have been due to nix.conf not setup properly for M1.</p>
<pre><code>       &gt; Configuring mtl-2.2.2...
   &gt; &quot;/nix/store/jjjbvzpal4b7n6hmnychrq07w36jnzjw-ghc-8.10.7/bin/ghc-pkg&quot; update -v0 --force --package-db=libraries/bootstrapping.conf libraries/mtl/dist-boot/inplace-pkg-config
   &gt; &quot;inplace/bin/ghc-cabal&quot; configure libraries/hpc dist-boot --with-ghc=&quot;/nix/store/jjjbvzpal4b7n6hmnychrq07w36jnzjw-ghc-8.10.7/bin/ghc&quot; --with-ghc-pkg=&quot;/nix/store/jjjbvzpal4b7n6hmnychrq07w36jnzjw-ghc-8.10.7/bin/ghc-pkg&quot;  --package-db=/private/tmp/nix-build-ghc-8.8.4.drv-1/ghc-8.8.4-configured-src/libraries/bootstrapping.conf --disable-library-for-ghci --enable-library-vanilla --enable-library-for-ghci --disable-library-profiling --disable-shared --with-hscolour=&quot;/nix/store/v35zbnmxnxh1axccw5agmplam8nbr0b8-hscolour-exe-HsColour-1.24.4/bin/HsColour&quot; --configure-option=CFLAGS=&quot;-Wall    -Wno-unknown-pragmas&quot; --configure-option=LDFLAGS=&quot;  &quot; --configure-option=CPPFLAGS=&quot;   &quot; --gcc-options=&quot;-Wall    -Wno-unknown-pragmas   &quot; --configure-option=--with-iconv-includes=&quot;/nix/store/cg81y8mlrvd3crly089xy6xd63nvzm4w-libiconv-50/include&quot; --configure-option=--with-iconv-libraries=&quot;/nix/store/cg81y8mlrvd3crly089xy6xd63nvzm4w-libiconv-50/lib&quot; --configure-option=--with-gmp-includes=&quot;/nix/store/nwfxg1dpzpkq9w2awp4zs5jawn4fvyb0-gmp-6.2.1-dev/include&quot; --configure-option=--with-gmp-libraries=&quot;/nix/store/j75k7na64g7xly1gxrkz44sby1gdc0sa-gmp-6.2.1/lib&quot; --configure-option=--with-curses-libraries=&quot;/nix/store/bs7hpi27xc0y2qynvx4n1zpnv3s5bnkx-ncurses-6.2/lib&quot;   --constraint &quot;binary == 0.8.7.0&quot;   --constraint &quot;transformers == 0.5.6.2&quot;   --constraint &quot;mtl == 2.2.2&quot;   --constraint &quot;hpc == 0.6.0.3&quot;   --constraint &quot;ghc-boot-th == 8.8.4&quot;   --constraint &quot;ghc-boot == 8.8.4&quot;   --constraint &quot;template-haskell == 2.15.0.0&quot;   --constraint &quot;text == 1.2.4.0&quot;   --constraint &quot;parsec == 3.1.14.0&quot;   --constraint &quot;Cabal == 3.0.1.0&quot;   --constraint &quot;ghc-heap == 8.8.4&quot;   --constraint &quot;ghci == 8.8.4&quot;   --constraint &quot;terminfo == 0.4.1.4&quot; --with-gcc=&quot;clang&quot; --with-ld=&quot;ld&quot; --with-ar=&quot;ar&quot; --with-alex=&quot;/nix/store/x1qgmqksr03kvdslwakbn4qbi4f5h3bs-alex-exe-alex-3.2.4/bin/alex&quot; --with-happy=&quot;/nix/store/ic7q31ff5n34k0x1x1xm8jldzh88c58s-happy-exe-happy-1.19.12/bin/happy&quot;
   &gt; Configuring hpc-0.6.0.3...
   &gt; ghc-cabal: Encountered missing or private dependencies:
   &gt; base &gt;=4.4.1 &amp;&amp; &lt;4.14
   &gt;
   &gt; libraries/hpc/ghc.mk:3: libraries/hpc/dist-boot/package-data.mk: No such file or directory
   &gt; make[1]: *** [libraries/hpc/ghc.mk:3: libraries/hpc/dist-boot/package-data.mk]        Error 1
   &gt; make: *** [Makefile:124: all] Error 2
   For full logs, run 'nix log /nix/store/40hp5wypw0djadrrcb1346hk2y0ridf2-ghc-8.8.4.drv'.
    error: 1 dependencies of derivation '/nix/store/qgyzqd5v4yn32fgns4vqwcr3qrqgy8ii-ghc-8.10.4.20210212-configured-src.drv' failed to build
    error: 1 dependencies of derivation '/nix/store/3i1f6vn82wg07dwvr24dm26l45jzx3sw-ghc-8.10.4.20210212.drv' failed to build
    error: 1 dependencies of derivation '/nix/store/irws4cdrncz0gdg5m68blqj3h0p86ivx-Cabal-lib-Cabal-3.4.1.0-config.drv' failed to build
    error: 1 dependencies of derivation '/nix/store/xrwzqagrirvim8bs8kpiqxikqf78qn30-Cabal-lib-Cabal-3.6.2.0-config.drv' failed to build
</code></pre>
<p>Also earlier in the nix-shell log I saw the following:</p>
<pre><code>    [217 of 285] Compiling Distribution.Simple.Program.GHC ( libraries/Cabal/Cabal/Distribution/Simple/Program/GHC.hs, bootstrapping/Distribution/Simple/Program/GHC.o )
    'apple-a7' is not a recognized processor for this target (ignoring processor)
</code></pre>
<p>Things I have tried:</p>
<p>Search for all nix.conf file and add the cache entries as above.
run as root: sudo nix-shell
sudo nix-build etc.</p>
<p>I am not familiar with nix and I might have missed some steps to be done prior to running nix-shell</p>
<p>PS. Also would like to clean the nix caches? So I can try again with clean cache. Is it the following?</p>
<pre><code>  rm $HOME/.cache/nix/binary-cache-v*.sqlite*
</code></pre>
<p>or is there a nix command for this?</p>
<p>And the nix log command for further details did not work either:</p>
<pre><code>  nix log /nix/store/40hp5wypw0djadrrcb1346hk2y0ridf2-ghc-8.8.4.drv
  error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override
</code></pre>
<p>using --extra-experimental-features indicates log is not recognized nix command.</p>
<p>UPDATE: Per suggestion I have updated the nix.conf per <a href="https://github.com/renzwo/cardano-plutus-apps-install-m1/blob/main/README.md" rel="nofollow noreferrer">https://github.com/renzwo/cardano-plutus-apps-install-m1/blob/main/README.md</a></p>
<p>And my exact nix.conf file is now:</p>
<pre><code> sandbox = false
 system = x86_64-darwin
 extra-platforms = x86_64-darwin aarch64-darwin
 experimental-features = nix-command
 extra-experimental-features = flakes
 extra-sandbox-paths = /System/Library/Frameworks /System/Library/PrivateFrameworks /usr/lib /private/tmp /private/var/tmp /usr/bin/env
 substituters        = https://hydra.iohk.io   https://iohk.cachix.org https://cache.nixos.org/
 trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
</code></pre>
<p>However, I now see a different error message:</p>
<pre><code> copying path '/nix/store/v3bzn8kiwxaip81hbdv9q3jhkxcmqrhk-git-2.32.0' from 'https://hydra.iohk.io'...
 building '/nix/store/zcv0q6cmd39zr580w9sq0z1wbkak0mqk-git-ls-files.drv'...

 ErrorErrorxexecuting '/nix/store/715y5lnw12vdcc3hh9sc9vbkdi6c83x6-bash-4.4-p23/bin/bash': Bad file descriptor
 error (ignored): error: end of string reached
 error: builder for '/nix/store/zcv0q6cmd39zr580w9sq0z1wbkak0mqk-git-ls-files.drv' failed with exit code 1;
   last 2 log lines:
   &gt; 
   &gt; ErrorErrorxexecuting '/nix/store/715y5lnw12vdcc3hh9sc9vbkdi6c83x6-bash-4.4-p23/bin/bash': Bad file descriptor
   For full logs, run 'nix log /nix/store/zcv0q6cmd39zr580w9sq0z1wbkak0mqk-git-ls-files.drv'.
 (use '--show-trace' to show detailed location information)
</code></pre>
<p>I see this running under both both bash and zsh shells</p>
<p>Here is full trace:</p>
<pre><code> sudo nix-shell --show-trace
 building '/nix/store/zcv0q6cmd39zr580w9sq0z1wbkak0mqk-git-ls- files.drv'...

 ErrorErrorxexecuting '/nix/store/715y5lnw12vdcc3hh9sc9vbkdi6c83x6-bash-4.4-p23/bin/bash': Bad file descriptor
 error: builder for '/nix/store/zcv0q6cmd39zr580w9sq0z1wbkak0mqk-git-ls-files.drv'   failed with exit code 1

   … while realising the context of path '/nix/store/g0769lx8bm7lna4gsdchiayk6n7gdcx5-git-ls-files/files'

   at /nix/store/bvynxhgsxhp6ds11ak1wnjx5h8avmfwf-source/lib/clean-git.nix:146:26:

      145|           submoduleDirs = lines (readFile (files + &quot;/submoduleDirs&quot;));
      146|           files = lines (readFile (files + &quot;/files&quot;));
         |                          ^
      147|         };

   … while evaluating 'lines'

   at /nix/store/bvynxhgsxhp6ds11ak1wnjx5h8avmfwf-source/lib/clean-git.nix:33:11:
</code></pre>
 1108: <p>The following git repo has the latest information on setting up your environment in Mac M1. I personally followed this tutorial and worked perfectly. I suggest you delete everything you have done before and start from scratch following this link. <a href="https://github.com/renzwo/cardano-plutus-apps-install-m1/blob/main/README.md" rel="nofollow noreferrer">https://github.com/renzwo/cardano-plutus-apps-install-m1/blob/main/README.md</a></p>
