Zsh Compinit Insecure Directories & global npm issues - MacOs Catalina - macos

I decided to move all of my work over to a new user on my macbook instead of combining my work and personal stuff under the same user.
Now I have issues with zsh complaining of insecure directories:
/usr/local/share/zsh/site-functions
/usr/local/share/zsh
/usr/local/share/zsh/site-functions/_brew
/usr/local/share/zsh/site-functions/_brew_cask
/usr/local/share/zsh/site-functions/_brew_services
/usr/local/share/zsh/site-functions/_heroku
Also after installing node and npm using nvm, I have an issues with global packages:
zsh: permission denied
I believe these two issues are related. (Zsh permission issues)
I don't know why all the hassle just to use a new user on Mac but does anybody know the solution please?
Most of the information related to this issue revolves around older versions of MacOs and fixes don't seem to work with Catalina.
I have tried:
compaudit | xargs chmod g-w - No effect.
ZSH_DISABLE_COMPFIX="true" - No effect, although I don't think that this would resolve the actual underlying issue?
cd /usr/local/share/zsh && sudo chmod -R 755 ./site-functions - Not fixed the issue.

Related

vagrant: command not found after install on Mac OSX 10.10.4

Downloaded Vagrant, and went through th installation process.
When I ran vagrant -v it says vagrant: command not found
It has put the files in /opt/vagrant/...
It should install in the Applications folder with a link to the /usr/bin so it is added to the shell path.
There is no directory that has been created during this process.
I am afraid I can't even get started with it. ITs obviously not creating all the shortcuts it needs to be able to run the commands.
I have looked for support on this issue and reported a bug.
I also accepted the xcode licence agreement.
Has anybody else had this issue.
My next step is to manually create the shortcuts.
If you look at the uninstall script including in the Vagrant DMG, it is referring to /usr/local/bin which does not exist. It should be error handling (the Vagrant pkg installer) and create it (permissions/ownership etc) but it doesn't.
You need to mkdir the /usr/local/bin. I tried a symlink between /usr/bin/vagrant (as /usr/bin exists, and in-path) to /opt/vagrant/bin/vagrant BUT this does not work, as later on in life, Vagrant refers in a hard fashion to /usr/local/bin/vagrant because its stupid.
$ sudo mkdir /usr/local/bin
If you sudo it, it should be made with correct ownership etc. Now just re-run the Vagrant installer pkg.
Make sure the Virtual Box setup is installed on Mac before installing Vagrant.
I raised the bug with https://github.com/mitchellh/vagrant/issues/6034
The issue is that I had no /usr/local directory at all.
It is an apple issue.
After I created the directories as you described I was able to install vagrant vitrual boax and laravel.
Here is what I did.
sudo mkdir /usr/local
Then bin.
cd /usr/local
sudo mkdir bin
I uninstalled Vagrant, re-installed and when I ran vagrant -v I then got the version.
cd /usr/local/bin
ls
sudo chmod 755 vagrant
Thanks for your Answer.
Weird, on 1.8.5 I couldn't run Vagrant either, noticed that /usr/local/bin was owned by root. Ran command
# chown -R User:Group /usr/local/bin
as root and works from my username now.

Virtualenv permission denied

After a lot of struggle with virtualenv/virtualenvwrapper I decided to remove all virtualenvs and re-install the packages.
root> su myuser
myuser> sudo pip install virtualenv
myuser> sudo pip install virtualenvwrapper
I proceeded to add this to my unix users .bashrc file.
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python2.7
source /usr/local/bin/virtualenvwrapper.sh
When I source .bashrc I get about 20 error lines ending with IOError: [Errno 13] Permission denied: '/root/.virtualenvs/premkproject'. I'm running out of ideas...
I have done my homework and tried every suggested solution I could find. I'm running Ubuntu 12.04.
I had the same problem and it was due to .virtualenvs having owner and group root. So the following would fix it (substituting ubuntu:ubuntu for your user and groups):
cd ~
sudo chown -R ubuntu:ubuntu .virtualenvs/
I used the recursive option as I had a problem installing a package with pip and that was due to a file lower down the hierarchy also having a permissions problem.
You never explained in which SO are you working...So if you are in Mac OS X you can easily fix it by giving eXecute permissions.
I believe Linux may face the very same problem altought I myself never got this problem under Linux.
The 'magic words' are the following :
chmod 755 <your path>/virtualenv.py

brew install - permission denied (after chown -R `whoami` )

$ brew install fontconfig
Error: Permission denied - /Library/Caches/Homebrew/Formula/fontconfig.brewing
$ sudo chown -R `whoami` /usr/local
$ brew install fontconfig
Error: Permission denied - /Library/Caches/Homebrew/Formula/fontconfig.brewing
Not sure where to go from here. Ran brew doctor to fix some existing issues, but can't seem to get past this.
trojanfoe's answer helped. There was a permission issue with the Library/Logs folder that I wasn't assigned to, but somehow the Library/Caches/Homebrew folder didn't exist. So I just created that, the subfolder Formula, and changed the permission and everything installed just fine. It actually cleared up a lot of errors I was having.
Thanks everyone.
Update
#fet's one liner works great.
mkdir -p ~/Library/Caches/Homebrew/Formula
For others that are running into the error of something like
$ brew upgrade
==> Upgrading 1 outdated package, with result:
libtool 2.4.6
==> Upgrading libtool
Error: Permission denied - /usr/local/lib/libltdl.7.dylib
Make sure that your directory, in this case /usr/local/lib, has sufficient permissions for you to access it. I ran into the issue where it was only assigned to root:admin.
$ ls -la /usr/local/lib/ | grep "libltdl.7"
lrwxr-xr-x 1 username admin 43 Oct 12 2014 libltdl.7.dylib -> ../Cellar/libtool/2.4.2/lib/libltdl.7.dylib
Switched that to myusername:admin and was able to upgrade with no problems.
cd /usr/local/lib
sudo chown `whoami`:admin .
Hope that helps!

MongoDB Insecure Startup for Mac OS X

I installed MongoDB via Brew and now I get this error:
“/Library/StartupItems/MongoDB” has not been started because it does not have the proper security settings
I've repaired permissions, reinstalled, and it doesn't go away. Any help?
Recent versions of OS X (since Snow Leopard IIRC) are pickier about the permissions on things like startupitems, and will disable them if it thinks they're inappropriate. This should set the permissions it's looking for:
sudo chown -R root:wheel /Library/StartupItems/MongoDB
sudo chmod -R u=rwX,go=rX /Library/StartupItems/MongoDB
sudo chmod -R -N /Library/StartupItems/MongoDB
If you'd like to remove the Startup item, here is a solution: Apple Support Site

Installing in Homebrew errors

Attempting to install rvm and ruby 1.9.2
I already installed homebrew and git, but couldn't get complete updates because I kept getting permission errors. Re-installed Snow Leopard and repaired permissions.
Now this happens...
$ brew install wget
Error: Cannot write to /usr/local/Cellar
sudo chown -R $USER /usr/local
You'll have to give yourself ownership of /usr/local/ using that line right there. I had to do this myself after using the ruby one-liner at the top of the official docs to install Homebrew. Worked like a charm for me. It ought to be the only time you'll ever need to sudo with Homebrew.
I'm not sure if the ruby one-liner does this. If it did, then something else on my system took control of /usr/local since.
Edit: I completely missed this, but #samvermette didn't (see replies to my answer): if you run this command above and have something installed via homebrew that requires special user permissions, like mysql, make sure to give those permissions back (as the above command gives recursive ownership to everything inside /usr/local to you ($USER). In the case of mysql, it's…
sudo chown -RL mysql:mysql /usr/local/mysql/data
I had this issue after upgrading to Mavericks, and this page was the top search result when googling the error message. I continued searching and found this answer on stack overflow.com. Put concisely, it is:
sudo chmod a+w /usr/local/Cellar
This fixed the issue for me, and as it only changes permissions for the specific path referenced in the error message, seemed unlikely to have negative side effects with other installations.
I'm putting this answer here for anyone else who may find this page first like I did. However, credit should go to jdi.
You can allow only Admin users writing into /usr/local/?
chgrp -R admin /usr/local
chmod -R g+w /usr/local
chgrp -R admin /Library/Caches/Homebrew
chmod -R g+w /Library/Caches/Homebrew
Since that each user who belongs to Admin group, will be able to install new dependencies.
On High Sierra you need the following command cause chown will not work:
sudo chown -R $(whoami) $(brew --prefix)/*
Link:
https://github.com/Homebrew/brew/issues/3228
uninstall and re install HomeBrew that will do the trick
I suggest ensuring that the current user is a member of the group that owns /usr/local. I believe by default, that group is wheel. To make yourself a member of that group:
$ sudo dscl . append /Groups/wheel GroupMembership $USER
Although something of an inelegant hammer, it has the intended effect - enabling access to items in /usr/local that are intended only for use (read/write) by elevated members. This approach has benefits of the other above because it takes advantage of the group memberships, enabling multiple (authorized) users on the system to use homebrew.
How did you install Homebrew? Their official installation instructions include running a ruby script. That should take care of the permission issues for you.
If you don't want to run a script, there is a section of that page called "Installing to /usr/local for Developers" that explains the change in permissions needed for the /usr/local directory.
EDIT: As mentioned in the comments it's a bad idea to use sudo with homebrew, so don't use the following answer!
You can also prevent this error if you execute the command with sudo:
$ sudo brew install wget
But take care of using sudo because you can make a lot of mistakes.

Resources