I have solc v0.5.2 on my system, but I have several contracts, that require solc < v0.5, so that I get errors:

Error: Source file requires different compiler version

What is the best way to run and choose between multiple versions of solc?

Just download solc v0.4.25, rename it into e.g. solc04 and move it into /usr/bin/? Or is there something like virtual environments for solidity?

2 Answers 2


You may be interested in the new truffle feature, the ability to specify your solidity compiler, https://github.com/trufflesuite/truffle/releases/tag/v5.0.0#user-content-what-s-new-in-truffle-v5-truffle-compile-solidity-specify-your-compiler-version.

As for manually switching between the 2, I think docker would be your best bet.


I found useful this solc version switcher tool https://github.com/crytic/solc-select.

My experience to configure it:

  1. docker pull trailofbits/solc-select
  2. manually add https://raw.githubusercontent.com/crytic/solc-select/master/bin/solc to any location
  3. add permissions to execute the script to the owner chmod u+x ...
  4. add location from 2. to .bash_profile

Now I am able to switch between Solidity versions with solc use ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.