Installation on macOS

To install solc on macOS, execute the following commands:

$ brew tap ethereum/ethereum
$ brew install solidity
$ brew linkapps solidity  

solc supports a variety of functions. A few examples are shown as follows:

  • Display contract in a binary format:
      $ solc --bin Addition.sol  

This command will produce an output similar to the following. This shows the binary translation of the Addition.sol contract code:

Solidity compiler binary output
  • Estimate gas:
      $ solc --gas Addition.sol

This will give the following output:

Get Advanced Blockchain Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.