Based on this tutorial.
Prerequisites:
% sw_vers
ProductName: macOS
ProductVersion: 11.6
BuildVersion: 20G165
% npm --v
8.1.2
And the MetaMask browser extension
Install Truffle and Ganache:
% npm install -g truffle
% npm install ganache-cli --global
Checks:
% npm --g list ganache-cli truffle
/usr/local/npm/lib
├── [email protected]
└── [email protected]
% truffle version
Truffle v5.4.26 (core: 5.4.26)
Solidity v0.5.16 (solc-js)
Node v16.13.1
Web3.js v1.5.3
% mkdir truffle-tutorial
% cd truffle-tutorial
% truffle unbox pet-shop
% truffle compile
% ganache-cli --gasLimit 0xffffffffff -p 8545
% truffle migrate
% truffle test
In MetaMask, configure the custom RPC: http://127.0.0.1:8545/ 1337
Sign into the account with the key: candy maple cake sugar pudding cream honey rich smooth crumble sweet treat
npm run dev
That's it!