I am trying to install truffle to my MacOs device but there is an ongoing issue that I couldn't figure out. It seems permission issue. Here is what I tried:

I modified priviliges of my current user:

sudo chown -R ${whoami} /usr/local/bin/truffle
sudo chown -R ${whoami} /usr/local/bin/node_modules

I switched to root user:

sudo su

I tried to install it by sudo:

sudo npm install -g truffle

Here is the log ouput:

node-pre-gyp WARN Using request for node-pre-gyp https download
    node-pre-gyp WARN Pre-built binaries not installable for sqlite3@4.2.0 and node@14.16.1 (node-v83 ABI, unknown) (falling back to source compile with node-gyp)
    node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/truffle/node_modules/sqlite3/lib/binding'
    gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/Users/macbookpro/Library/Caches/node-gyp/14.16.1"
    gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/truffle/node_modules/sqlite3/.node-gyp"
    gyp WARN install got an error, rolling back install
    gyp WARN install got an error, rolling back install
    gyp ERR! configure error
    gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/truffle/node_modules/sqlite3/.node-gyp'
    gyp ERR! System Darwin 19.6.0
    gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/truffle/node_modules/sqlite3/lib/binding/node-v83-darwin-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/usr/local/lib/node_modules/truffle/node_modules/sqlite3/lib/binding/node-v83-darwin-x64" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83"
    gyp ERR! cwd /usr/local/lib/node_modules/truffle/node_modules/sqlite3
    gyp ERR! node -v v14.16.1
    gyp ERR! node-gyp -v v5.1.0
    gyp ERR! not ok
    node-pre-gyp ERR! build error
    node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/truffle/node_modules/sqlite3/lib/binding/node-v83-darwin-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/usr/local/lib/node_modules/truffle/node_modules/sqlite3/lib/binding/node-v83-darwin-x64 --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
    node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/truffle/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
    node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
    node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1048:16)
    node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
    node-pre-gyp ERR! System Darwin 19.6.0
    node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/truffle/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
    node-pre-gyp ERR! cwd /usr/local/lib/node_modules/truffle/node_modules/sqlite3
    node-pre-gyp ERR! node -v v14.16.1
    node-pre-gyp ERR! node-pre-gyp -v v0.11.0
    node-pre-gyp ERR! not ok
    Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/truffle/node_modules/sqlite3/lib/binding/node-v83-darwin-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/usr/local/lib/node_modules/truffle/node_modules/sqlite3/lib/binding/node-v83-darwin-x64 --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
    > truffle@5.3.5 postinstall /usr/local/lib/node_modules/truffle
    > node ./scripts/postinstall.js
    Error: EACCES: permission denied, mkdir '/Users/macbookpro/.config/truffle'
    You don't have access to this file.
  • What OS? Big Sur won't let you mod SIP locations at all. – Tetsujin May 9 at 17:49
  • It's MacOs Catalina. – Snefru Clone May 9 at 17:55
  • Yeah, Catalina was already using the split HD/HD Data structure, similar thing. idk how to get around it, but it will not let you take perms on the boot volume. [I'm still on Mojave with all Macs here - I like to be in control of my own destiny ;)) – Tetsujin May 9 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.