'EACCES: permission denied, open '/Users/stefma/.config/truffle/config.json' after installing Truffle

I tried literally all there is so far and I still can't run truffle macOS 11.6. that's what I tried after of course first installing it with the command npm install -g truffle:

  1. Downloading command line tools for Xcode and then installing with sudo npm install -g truffle

  2. sudo npm install --unsafe-perm=true --allow-root truffle

  3. sudo chown myUsername:myUsername -R ~/.config

  4. installing npm and node with nvm all over.

I'd be really grateful for any help



Solution 1:[1]

This should work kindly check [YourMacOSUserName] in fir place you MacOSUserName in it and please must rate my effort will be here for any further query.

sudo rm -rf /Users/[YourMacOSUserName]/Library/Preferences/netlify/

npm install -g netlify-cli

sudo ntl login

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Amir Hamza