- If you are in Ubuntu, use ppa to install the compiler by running the following command:
sudo add-apt-repository ppa:ethereum/ethereum sudo apt-get update sudo apt-get install solc
- If you are using macOS, install the compiler using brew:
brew update brew tap ethereum/ethereum brew install solidity
- Verify the installation with the following command:
solc --version
- Use this command to compile a contract and print the binary:
solc --bin SampleContract.sol
- You want to get some of the more advanced output from solc:
solc -o outDirectory --bin --ast --asm --abi --opcodes SampleContract.sol
We can configure it using these provided flags:
- --ast: Abstracts the syntax trees of source files
- --asm: EVM assembly of the contracts
- --abi: ABI specification of the contracts
- --opcodes: Opcodes of the contracts
You can get the complete list of operations supported by the solc compiler by running solc --help.