not able to install anything because of brew no such file or directory error - permissions

I am trying to install do brew install python3 on my mac but i keep getting the following errors:
this is the first error:
No such file or directory # dir_chdir - /usr/local/Cellar
then a bit later i get this error:
An exception occurred within a child process:
Errno::EPERM: Operation not permitted # dir_s_mkdir - /usr/local/Cellar
I have ran brew update then brew doctor the brew cleanup but keep getting the error.
I have also checked to see if xcode is up-to-date but according to the appstore all my apps are up-to-date.
How do i fix this problem?
PS i also get these errors when trying to install other packages from brew.

Try uninstalling Homebrew and then re-installing solved issue for me.
Uninstall Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
Re-install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Performed in MacOS Mojave (10.14.4)

Happened to me when uninstalling Laravel Valet.
Fixed by running: brew doctor, then brew cleanup after.
After that - brew install php worked just fine.

I experienced a similar error with a different package - brew install llvm.
Uninstalling homebrew and reinstalling led to more catastrophic issues that lasted for hours before I had to reach for my backup drive and restore everything.
What eventually worked was just creating the missing directory and everything worked.
So in this case:
sudo mkdir /usr/local/Cellar/dir_chdir
should solve the issue without too much hustle.

It worked for me after running below commands
sudo mkdir /usr/local/Cellar/dir_chdir
sudo chown -R $(whoami) /usr/local/Cellar
chmod u+w /usr/local/Cellar

I had this problem as well - it was partly coming from brew being installed under a different user on my mac I had set up for a past project. I had to follow the uninstall instructions (found in the homebrew github) with a little bit of sudo help and it cleared up the issue. Was able to install and properly run packages after.

For ubuntu just go to the location which u are getting error. Then open the contained file using a suitable application. In my case, it is getting as follows in the image view.
In this case, the error is showing in 36's lines.
yes. There is no location such as. I have to find out the location which contains brew. It was in /home/linuxbrew/.linuxbrew//bin/brew shellenv
So update your .profile file as in the brew file contains location as follows image shown.

uninstall brew :
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
and again reinstall brew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
executed this same as it is on your terminal, it will really work.

Related

How to download it without pip2

I tried to download the cuckoo on windows, While I got the error 'pip2 install -U cuckoo'.
The default version of pip on my windows system is for python3.
I tried to download python27, and went to the folder, try to pip install. I still failed
It is a little trick.
First, you do need to download the python27 and go to the python27 directory.
Then, you need to download pip2 (https://bootstrap.pypa.io/2.6/get-pip.py), use this command: curl https://bootstrap.pypa.io/2.6/get-pip.py -o get-pip.py
Then python.exe get-pip.py
Now, it still does not work if you just type pip2 install ..
You should use python.exe -m pip install -U cuckoo. (download package under the version of this directory).
After you download the WSL for ubuntu 16.04. You will meet an error the next time you reboot your PC. It is like registerDistribution error. You just need to uninstall all anti-virus software. For me, it is the McAfee. After you uninstall it, reboot your pc. You will find it works normally.
The reference is https://www.youtube.com/watch?v=nLGJHgv6uWA.

How to completely uninstall brew and re-install brew in ubuntu 19.04

I installed homebrew on ubuntu 19.04 and it's accidentally stop, so the install not complete. but the folder already created.
If I install it again
sudo apt install linuxbrew-wrapper
I get a message:
linuxbrew-wrapper is already the newest version
but if I write command :
brew upgrade
I get this message:
Command 'brew' not found, but can be installed with:
sudo apt install linuxbrew-wrapper".
Can anyone help me fix this?
Maybe this can help more people...
I just executed the following command line
$/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
This is the same url as in here Homebrew homepage but instead of install.sh, I used uninstall.sh.
After performing what https://stackoverflow.com/a/57208010/2787992 said, you might need to run
sudo rm -rf /home/linuxbrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
sudo rm -rf /home/linuxbrew
For details see: https://www.how2shout.com/linux/how-to-install-brew-ubuntu-20-04-lts-linux/
Try uninstalling the packages.
To remove just linuxbrew-wrapper package
sudo apt-get remove linuxbrew-wrapper
If you want to delete configuration and data files
sudo apt-get purge linuxbrew-wrapper
Source your bashrc first
source ~/.bashrc 

Ubuntu Cannot reinstall coreutils

I deleted the usr/bin/env directory/file in my Ubuntu16.04 by mistake. Everytime i try to reinstall coreutils with this command:
sudo apt-get install --reinstall coreutils, i get this error:
Reinstallation of coreutils is not possible, it cannot be downloaded.
I can't use npm because it needs that directory.
Please help.
I solved this by manually getting the env file from the coreutils package i downloaded from the Ubuntu site and replacing where i deleted it.

Git init -q Permissions error while installing Homebrew

I'm attempting to install HomeBrew on OS X 10.12.6. When I use the autoinstall script from Homebrew's website:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Everything runs smoothly until it begins actually downloading and installing Homebrew, at which point it returns the following error:
==> Downloading and installing Homebrew...
/usr/local/homebrew/.git: Permission denied
Failed during: git init -q
Any tips of how to resolve this? Any assistance would be greatly appreciated!
You should make your /usr/local/bin and /usr/local/opt writeable, i.e.:
chmod +w /usr/local/bin
chmod +w /usr/local/opt
Depending on your user's permissions you may have to use sudo to achieve it.
Maybe git is missing:
apt install git

Laravel valet linked php error

I got an error.
$ valet install
[DomainException]
Unable to determine linked PHP.
install
'which' command returns:
$ which php
/usr/local/Cellar/php70/7.0.6/bin/php
I used Homebrew to instal php7.1 , So I ran this command in terminal
ln -s /usr/local/opt/php71/bin/php /usr/local/bin/php
and everything is done.
if your PHP version 7.x and valet > 2.0.8 update valet
valet stop
valet uninstall
brew install php
composer global require laravel/valet
then valet install
Homebrew creates (or attempts to create) symlinks in /usr/local/bin.
Start by running the following to attempt to create a link.
brew link php70
It'll give you information as to whether or not it was successful. Occasionally permissions are problematic and you can resolve this with
sudo chown -R `whoami`:admin /usr/local/bin
Then try running the brew link command again.
Alternately brew link may give you instructions, or you can use brew doctor to get a report on any problems which exist with your Homebrew installation.
When it's set up properly after running ls -la /usr/local/bin | grep bin/php$ you should see something similar to
lrwxr-xr-x 1 YOURUSER admin 29 10 May 21:40 php -> /usr/local/Cellar/php70/7.0.6/bin/php
I was going to update Laravel Valet from version 1.* to 2 and ran same error like this
Unable to determine linked PHP
The solution was to run
composer global update
before I ran
valet install
This happens when your brew php gets Updated.
If you do brew install php this will work but will install php 7.2 by default.
If you want php#7.1 you have to do brew install php#7.1 this will install php7.1 and now when you restart valet valet restart you might get an error. Unable to determine linked PHP.
To make this work with php7.1 you have make brew link
brew link php71
you may have this error
Warning: php#7.1 is keg-only and must be linked with
to fix this
brew link --force php71
now valet should work on php7.1
I tried all of the suggestions here—and several from elsewhere—before I hit on the solution. This applies to PHP 7.2 (no guarantee for other versions). If you are using the original Larvel Valet, open the file:
~/.composer/vendor/laravel/valet/cli/Valet/Brew.php
...or, if you're using Valet+
~/.composer/vendor/weprovide/valet-plus/cli/Valet/Brew.php
Locate the supportedPhpVersions method. In some versions, it will return an array right in the method:
return ['php72', 'php71', 'php70', 'php56'];
Change this to:
return ['7.2', 'php72', 'php71', 'php70', 'php56'];
In other cases, it'll reference const SUPPORTED_PHP_VERSIONS, and the change will be similar.
Save the file, restart valet, and Bob's your uncle!