Skip to content
A script to quickly switch between Solidity compiler versions
Branch: master
Clone or download
Latest commit c96e3e7 Apr 22, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Fixes bash string compares (#10) Mar 28, 2019
scripts Fix the mount point paths (#13) Apr 22, 2019
.gitignore Initial commit Jan 14, 2019
Dockerfile Use a script for the chroot commands Mar 23, 2019
LICENSE Added a LICENSE Feb 19, 2019
README.md Update README.md Apr 19, 2019

README.md

solc-select

A script to quickly switch between Solidity compiler versions.

It is becoming increasingly hard to run older versions of solc, particularly on macOS since there are no official binary releases. Versions prior to 0.5.0 no longer compile on macOS and are not maintained. This is a problem because older Ethereum contracts no longer compile on modern versions of Solidity. solc-select is a utility that allows one to run any legacy version of Solidity simply by setting an environment variable.

Quickstart

docker pull trailofbits/solc-select
docker run --read-only -i --rm --entrypoint='/bin/sh' trailofbits/solc-select:latest -c 'cat /usr/bin/install.sh' | bash -e

This will install solc globally. If solc is already installed, you will be prompted to overwrite it.

To install solc to a different directory, run the docker command with the environment variable PREFIX set; solc will be installed to ${PREFIX}/bin/solc.

Alternatively, manually copy the special solc script to your desired location.

Usage

The desired version of solc can be specified using the SOLC_VERSION environment varialble. By default, the latest version is used.

$ solc --version
solc, the solidity compiler commandline interface
Version: 0.5.2+commit.1df8f40c.Linux.g++
$ SOLC_VERSION=0.4.24 solc --version
solc, the solidity compiler commandline interface
Version: 0.4.24+commit.e67f0147.Linux.g++

You can list all available versions with the special --versions argument:

$ solc --versions
0.4.11
0.4.12
0.4.13
0.4.14
0.4.15
0.4.16
0.4.17
0.4.18
0.4.19
0.4.20
0.4.21
0.4.22
0.4.23
0.4.24
0.4.25
0.5.0
0.5.1
0.5.2
0.5.3
0.5.4
0.5.5
nightly

Upgrading

Once installed, simply run

solc --upgrade

to automatically upgrade solc-select. This will automatically pull the latest Docker image and upgrade the local solc script, if necessary. The DockerHub image for solc-select will automatically update every time Solidity is updated, which will typically be nightly.

Installation from Source

$ git clone https://github.com/trailofbits/solc-select.git
$ cd solc-select
$ docker build -t trailofbits/solc-select:latest .
$ bin/solc --install

Getting Help

Feel free to stop by our Slack channel for help on using or extending solc-select.

License

solc-select is licensed and distributed under the AGPLv3 license. Contact us if you’re looking for an exception to the terms.

You can’t perform that action at this time.