Cardano Academy
Search…
⌃K

How do I run "cabal build" / "cabal repl"?

I recommend to use cabal in nix-shell , it manages the environment and dependencies for you.
Step 1: Go to your plutus repository directory, run nix-shell.
cd plutus
nix-shell
Step2: Once nix-shell is ready, change directory to code folder, for example:
cd ../plutus-pioneer-program/code/week02
Step 3: Now you can run cabal build or cabal replas you need. (You may need to run cabal update first.)
cabal update
cabal repl

Troubleshooting

If you are getting this error:
error: cannot update the ref 'refs/remotes/origin/master': unable to append to '.git/logs/refs/remotes/origin/master': Permission denied From https://github.com/input-output-hk/cardano-ledger-specs ! 54490eff..07388041 master -> origin/master (unable to update local ref) error: cannot lock ref 'refs/remotes/origin/polina/min-utxo-alonzo': Unable to create '/home/alvin/workspace/cardano/plutus-pioneer-program/code/week02/dist-newstyle/src/cardano-l_-48e3a74bf8b61f34/.git/refs/remotes/origin/polina/min-utxo-alonzo.lock': Permission denied ! [new branch] polina/min-utxo-alonzo -> origin/polina/min-utxo-alonzo (unable to update local ref) error: cannot update the ref 'refs/remotes/origin/ts-checkPlutusBytes-toolong': unable to append to '.git/logs/refs/remotes/origin/ts-checkPlutusBytes-toolong': Permission denied ! 29c29d36..3789adfd ts-checkPlutusBytes-toolong -> origin/ts-checkPlutusBytes-toolong (unable to update local ref)
you can run this command to fix the file ownership:
sudo chown -R "${USER:-$(id -un)}" .