I can't install solc on Mac OS X. I have tried the following:
npm install solc
/Users/punddalinni
└── solc@0.3.0-1
npm WARN enoent ENOENT: no such file or directory, open '/Users/punddalinni/package.json'
npm WARN punddalinni No description
npm WARN punddalinni No repository field.
npm WARN punddalinni No README data
npm WARN punddalinni No license field.
When I go back to geth, and I run
> eth.getCompilers()
[""]
When I tried to setSolc the following happened
> admin.setSolc('/Users/punddalinni/node_modules/solc')
exec: "/Users/punddalinni/node_modules/solc": permission denied
at InvalidResponse (<anonymous>:-81662:-57)
at send (<anonymous>:-156322:-57)
at setSolc (<anonymous>:-133322:-57)
at <anonymous>:1:1
I have tried following the directions here but it gets stuck at
brew install llvm --HEAD --with-clang
EDIT: Including contents of package.json from solc in Mac.
{
"_args": [
[
"solc",
"/Users/punddalinni"
]
],
"_from": "solc@latest",
"_id": "solc@0.3.0-1",
"_inCache": true,
"_installable": true,
"_location": "/solc",
"_nodeVersion": "4.0.0",
"_npmOperationalInternal": {
"host": "packages-13-west.internal.npmjs.com",
"tmp": "tmp/solc-0.3.0-1.tgz_1457892692634_0.5487515390850604"
},
"_npmUser": {
"email": "d11e9@turkd.net",
"name": "d11e9"
},
"_npmVersion": "3.3.2",
"_phantomChildren": {},
"_requested": {
"name": "solc",
"raw": "solc",
"rawSpec": "",
"scope": null,
"spec": "latest",
"type": "tag"
},
"_requiredBy": [
"#USER"
],
"_resolved": "https://registry.npmjs.org/solc/-/solc-0.3.0-1.tgz",
"_shasum": "523e79db0c69070f91fcbf408e8c7d0c93be176c",
"_shrinkwrap": null,
"_spec": "solc",
"_where": "/Users/punddalinni",
"author": {
"name": "chriseth"
},
"bugs": {
"url": "https://github.com/chriseth/browser-solidity/issues"
},
"dependencies": {},
"description": "Solidity compiler",
"devDependencies": {},
"directories": {},
"dist": {
"shasum": "523e79db0c69070f91fcbf408e8c7d0c93be176c",
"tarball": "http://registry.npmjs.org/solc/-/solc-0.3.0-1.tgz"
},
"gitHead": "5ce686c8d33db78c8f1eb8e2318eefbc5151f0eb",
"homepage": "https://github.com/chriseth/browser-solidity#readme",
"keywords": [
"compiler",
"ethereum",
"solidity"
],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "chriseth",
"email": "c@ethdev.com"
},
{
"name": "d11e9",
"email": "d11e9@turkd.net"
}
],
"name": "solc",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/chriseth/browser-solidity.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "0.3.0-1"
}
Any ideas?
Best Answer
I wasn't familiar with NPM, so had some similar issues. Simply running
npm install solc
will attempt to install locally, which can present some permission and linking issues- this is likely the cause of the problem.Instead, install solC globally by using
$ npm install -g solc
(you may also want to try$ npm install solc --global
as I'm not sure which of these two commands fixed my issue).If this is installed, check where it's been installed by running
$ which solcjs
which should yield something like/usr/local/bin/solcjs
I found that I needed to also use Homebrew to install/build solC, following the installation instructions. Once Brew was done, I checked that solC was installed with
$ which sol
.Copy this directory, then once you've launched
geth console
use it in the setSolc command, like> admin.setSolc("/usr/local/bin/solc")
With luck, you'll get a confirmation message, and the next time your run
> eth.getCompilers()
the result should be something like["Solidity"]