Search code examples
compilationethereumsolidity

Where does solidity compiler saves the compiled binaries?


I am able to compile the contract but I need to know where those compiled binaries are saved.. I'm using macOs BigSur. I'm really struggling with that.. please help


Solution

  • Based on tags of this question, I'm assuming that you're using the solc binary compiler without any framework (such as Hardhat, Brownie, etc).

    By default, solc does not save the binaries. You can specify the output destination with the -o option.

    # compiles `MyContract.sol` and saves the output to the `binaries` folder
    solc --bin -o ./binaries/ ./MyContract.sol
    

    From solc --help:

    Output Options:
      -o [ --output-dir ] path
                           If given, creates one file per component and 
                           contract/file at the specified directory.