We recommend that you use Remix to develop simple contracts and quickly learn Solidity
Remix it can be used online without installing anything. If you want to use it offline, press https://github.com/ethereum/browser-solidity/tree/gh-pages download the zip file to use. This page provides further details on how to install the Solidity command line compiler on your computer. If you are just dealing with large contracts or need more compilation options, you should choose to use the command line compiler solc.
npm can easily install the Solidity compiler solcjs. But
solcjs function of the program is less than all other options below this page. In
commandline-compiler chapter, we assume that you are using a full-featured compiler. So if you are from
solcjs ，jump directly solc-js understand .
npm install -g solc
In the command, use
solcjscommand options are the same
solcand some tools（such
geth)is incompatible, so don't expect
solcwork the same.
We provide the latest docker build for the compiler.
stable published version is in the warehouse,
nightlyrepository is a version with unstable changes in the development branch.
docker run ethereum/solc:stable solc --version
Currently, docker images only contain solc executable programs, so you need extra work to connect the source code with the output directory.
Can be in solidity/releases download
Solidity binary installation package.
For Ubuntu, we also provide PPAs. You can obtain the latest stable version by using the following command:
sudo add-apt-repository ppa:ethereum/ethereum sudo apt-get update sudo apt-get install solc
Of course, you can also install an early version of the developer:
sudo add-apt-repository ppa:ethereum/ethereum sudo add-apt-repository ppa:ethereum/ethereum-dev sudo apt-get update sudo apt-get install solc
sudo snap install solc
Or, if you want to test the latest changes under the develop branch, you can install the developer version as follows:
sudo snap install solc --edge
Arch Linux Installation packages are also available, but only for the latest developer version:
pacman -S solidity
At the time of writing this article, Homebrew did not provide a pre-built binary package (because we migrated from Jenkins to TravisCI). We will provide the binary installation package under homebrew as soon as possible, but at least it works from the source code:
brew update brew upgrade brew tap ethereum/ethereum brew install solidity
If you need a specific version Solidity , you need to start from Github Install one on Homebrew formula, You can consult
solidity.rb commits on Github submitted records, to find contains
solidity.rb special submission of file changes. Then use
brew unlink solidity # Install 0.4.8 brew install https://raw.githubusercontent.com/ethereum/homebrew-ethereum/77cce03da9f289e5a3ffe579840d3c5dc0a62717/solidity.rb
Gentoo Linux the installation package is also provided below, which can be used
Run the following command to clone the source code:
git clone --recursive https://github.com/ethereum/solidity.git cd solidity
If you want to participate Solidity Development of, you can fork Solidity After the source code library, use your personal Fork Library as the second remote source:
cd solidity git remote add personal firstname.lastname@example.org:[username]/solidity.git
Git Sub-modules, make sure they are fully loaded:
git submodule update --init --recursive
In macOS, make sure that the latest version is installed
Xcode contains Clang C++ compile， and
Xcode IDE and other Apple development tools are
C++ required for the application. If you have installed Xcode for the first time or just updated the new version of Xcode, you must agree to the use protocol of Xcode before using the command line to build:
sudo xcodebuild -license accept
Windows build under
Solidity , the dependency software package to be downloaded:
||C command line tool for obtaining source code from Github|
||Build a file generator across platforms|
||C++ Compiler and development environment|
If you already have
IDE，only the compiler and related libraries are required, you can install
Visual Studio 2017 Build Tools。
Visual Studio 2017 provider
IDE and necessary compilers and libraries. So if you don't have one
IDE and want to develop
Visual Studio 2017 it will be a simple choice that allows you to get all the tools.
Here is one in
Visual Studio 2017 Build Tools or
Visual Studio 2017 list of components to be installed in:
- Visual Studio C++ core features
- VC++ 2017 v141 toolset (x86,x64)
- Windows Universal CRT SDK
- Windows 8.1 SDK
- C++/CLI support
On macOS, Windows, and other Linux distributions, there is a script that can install the required external dependencies with one click. It was originally a multi-step operation that requires manual participation, but now it only needs one line of command:
Run in Windows:
Make sure you have installed external dependencies (see above)
Solidity uses CMake to configure the build. Linux, macOS, and other Unix systems are built in the same way:
mkdir build cd build cmake .. && make
There are also simpler ones:
#note: 将安装 solc 和 soltest 到 usr/local/bin 目录 ./scripts/build.sh
mkdir build cd build cmake -G "Visual Studio 15 2017 Win64" ..
The last sentence of this set of instructions will create a solidity.sln file. After double-clicking, Visual Studio is opened by default. We recommend that you create on RelWithDebugInfo configuration file.
Or use the command to create:
cmake --build . --config RelWithDebInfo
If you are interested in the CMake command option, you can execute it
cmake .. -LH view
Detailed description of version number string
The Solidity version name consists of four parts:
- Version number
- Pre-release version, usually
commit.GITHASHsubmission number displayed in the format.
- Platform identification consisting of several platforms and compiler details
If there is a local modification, the commit part has a suffix
These parts are combined according to the requirements of Semver. The pre-release version number of Solidity is equivalent to the pre-release version number of Semver. The Solidity submission number and platform identification form the build metadata of Semver.
Pre-release layout sample:
After the version is released, the patch version will increase because we assume that only patch-level changes will occur later. When changes are merged, the version should be adjusted according to semver and the intensity of the changes. Finally, the release version is always consistent with the version number of the current daily build version, but does not
- 0.4.0 release Version
- From now on, build version 0.4.1 every night
- Introduce non-destructive changes-do not change the version number
- Introduce disruptive changes-version jump to 0.5.0
- Version 0.5.0 released
This method and
version pragma Run well together.