I have finally got the plutus-playground running on 2 separate machines. Each machine is a Mac running Catalina 10.15.7.
After extensive trial and error (some self inflicted) I have identified several points of confusion in the instructions provided, and other tips and suggestions. I hope this is helpful.
There are 3 installation instructions I drew from. None appear to be completely correct.
- https://docs.plutus-community.com/docs/setup/MacOS.html
- https://tutorials.cardanoacademy.io/plutus-pioneer-program/setting-up-plutus-playground/installing-nix
- https://www.reddit.com/r/cardano/comments/mmzut6/macos_plutus_playground_build_instructions/
So here is what I learned.
- Anywhere you are advised to restart your machine, DO restart your machine. Anywhere you are advised to exit your shell, restart your machine. Ten extra reboots is easier than an unwanted GHC build or a nix-shell fail.
- After installing Nix, and after restarting your machine, I suggest running these 3 commands to confirm with a modicum of comfort that all is well.
nix doctor --verbose
That last one is to retain the help for later review.
nix --version
nix --help > nix_help.txt
- The client and server files are NOT in
https://github.com/input-output-hk/plutus
but are instead inhttps://github.com/input-output-hk/plutus-apps
Thank you to nyk and ironhand89 for pointing this out.BOTH repositories should be cloned to your local directory, as follows:
git clone https://github.com/input-output-hk/plutus.git
In addition, I found that then running git pull from within each directory helped. There was a 4-6 hour gap from when I cloned to when I ... did more, so maybe some files were updated during that time.
git clone https://github.com/input-output-hk/plutus-apps.gitcd plutus
git pull
cd ../plutus-apps
git pull
- It seems that certain things that failed when invoked from zsh worked correctly when invoked from bash. This especially seems to have gotten me past the
[$] nix-build -A plutus-pab
roadblock. I suggest doing all of this work in bash. - I needed to invoke this before I found joy:
cd plutus-apps
I found this command at
git checkout 3746610e53654a1167aeb4c6294c6096d16b0502https://tutorials.cardanoacademy.io/plutus-pioneer-program/setting-up-plutus-playground/cloning-plutus-repository
I suspect this gave me an outdated version, but it seemed to be necessary. Any insight is welcome here. - I ended up editing /etc/nix/nix.conf to have this content (note: this includes the "IOHK binary caches" and double check where the line breaks should or shouldn't be):
build-users-group = nixbld
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=
sandbox = true
extra-sandbox-paths = /System/Library/Frameworks /System/Library/PrivateFrameworks /usr/lib /private/tmp /private/var/tmp /usr/bin/envexperimental-features = nix-command
extra-experimental-features = flakesSome of these were based on error messages I got along the way. Any insight from more knowledgeable people is welcome. And RESTART after configuring nix.conf.
- When you are ready to invoke nix-shell, WAIT! Pause. Ask yourself if everything else has been set up. Restart your machine. Be certain you are in the correct (cloned repository) directory plutus-apps/. Every time you invoke nix-shell in a different directory you can kiss an hour of your life goodbye and chew up 10GB of hard drive space (which would have cost $3 million in 1983). Pause, take a breath, treat nix-shell like a career decision.
- Do not build Haskell from scratch! You will know this is happening if you see a bunch of filenames flashing by with hask, cabal, or .hs in them. Hit ctrl-C ( or command-. which is command and period together ), restart your machine, pause as above, and try again.
- I added this to .zshrc but since I switched to bash I don't know if it was necessary.
source /nix/var/nix/profiles/default/etc/profile.d/nix.sh