Solving technical problems is extremely satisfying because you end up spending sometimes hours tearing your hair out and eventually, after thinking there’s simply no solution, you hit the nail right on the head.
This evening I ran into a permission issue with my macOS Mojave filesystem. I tried ignoring the issue but I soon realised that wasn’t a good strategy.
It all began whilst creating a landing page for this website. For some reason, the local development version of this website wasn’t styled properly whereas the production website was absolutely fine. Same files and folders, totally different looking website. What’s going on?
I tried reinstalling the child theme to no avail, and I tried a couple of other things. I eventually figured out a way around it, which was to download the child theme’s content from the production site file by file, folder by folder, which worked. But then I noticed I couldn’t install node_modules to carry on with my work. Another roadblock!
Terminal commands were either ‘not found’ or ‘not permitted’ and it was incredibly frustrating.
Homebrew is an important one because it essentially simplifies the installation of software on macOS operating systems and Linux. When you can’t do anything with Homebrew due to permissions, you’re kinda screwed. This is because the Homebrew package resides in /usr/local – and for some reason, /usr/local didn’t have the right permissions – meaning everything in there wasn’t working, essentially all package managers.
The idea was to use Homebrew to uninstall Node & NPM because NPM commands were not working. I needed to use NPM to reinstall the node_modules locally. Totally impossible if you don’t have permission to use Homebrew or NPM.
This was the error I ran into frequently:
chown: /usr/local: Operation not permitted
After searching through tons of Stack Exchange questions I finally found a solution! Turns out I was actually able to uninstall Homebrew with this command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Then reinstall it with this command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then suddenly all of the filesystem permissions were restored and there were no more issues using commands. The point of me writing this is this: Coding Teaches You to Persevere, Even When Times Are Tough. And That’s The Beauty of Solving Problems!
Check out the links below to find out more about the stuff I mentioned above.