Skip to content

Instantly share code, notes, and snippets.

@jamesmurdza
Last active May 12, 2022 03:10
Show Gist options
  • Save jamesmurdza/e5b5e7c2f211cc264d0f8595e53c5f5d to your computer and use it in GitHub Desktop.
Save jamesmurdza/e5b5e7c2f211cc264d0f8595e53c5f5d to your computer and use it in GitHub Desktop.
Truffle on macOS Tutorial

Truffle on macOS Tutorial

Based on this tutorial.

Prerequisites:

% sw_vers
ProductName:	macOS
ProductVersion:	11.6
BuildVersion:	20G165
% npm --v
8.1.2

And the MetaMask browser extension

Setup:

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

Tutorial:

% 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!

Result:

Result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment