今日はEthereumのスマートコントラクト開発時に利用する言語「Solidity」のフレームワークである「Truffle」をMacOSへインストールする方法を説明していきます。
Contents [hide]
環境
- MacOS High Sierra v10.13.6
- nvm v0.33.11
- Node.js v8.11.3
- npm v5.6.0
Node.js周りのインストール
nvm(Node Version Manager)のインストール
まずはNode.jsのバージョン管理ツールである、nvm(Node Version Manager)をインストールします。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# curlからインストール | |
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash | |
# PATHを再読込する | |
$ source ~/.bashrc | |
# インストールが成功していたらバージョンが表示されます | |
$ nvm --version | |
0.33.11 |
Node.jsとnpm(Node Packaged Modules)のインストール
続いてNode.jsとパッケージ管理ツールであるnpm(Node Packaged Modules)をインストールしていきます。
nvmがインストールされていれば、こちらは簡単にインストールが可能です。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# nvmからコマンド1つでインストール可能です | |
$ nvm install v.8.11.3 | |
# インストールが成功していればバージョンが表示されます | |
$ node --version | |
v8.11.3 | |
$ npm --version | |
5.6.0 |
以上でNode.js周りのインストールは完了です。
Truffleのインストール
続いて、本題である「Truffle」のインストールを行っていきます。
npmでインストールできてしまうので、コマンド1つ叩いて終了です。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ npm install -g truffle | |
# インストールが成功していればバージョンが表示されます | |
$ truffle version | |
Truffle v4.1.13 (core: 4.1.13) | |
Solidity v0.4.24 (solc-js) |
以上でMacOSへTruffleをインストールすることができました。
次回以降でTruffleの使い方について解説していきたいと思います。