Error when trying to "brew link autoconf" - rvm

When I try to "brew link autoconf" in the terminal I keep getting this error.
Error: Could not symlink file: /usr/local/Cellar/autoconf/2.69/share/emacs/site-lisp
/usr/local/share/emacs is not writable. You should change its permissions.
Anyone have any ideas on how to fix this? Thanks!

You need to make sure that all the files and folders in /usr/local are writable by you. You can do this by typing the following command
chown -R yourusername /usr/local
chmod -R u+w /usr/local
You may have to use sudo for those commands to work.
After you do this, try linking again.

(sudo) chown -R yourusername /usr/local

I had to run
chmod -R u+w /usr/local
brew link --overwrite autoconf
brew install htop

I tried under /usr/local/share/emacs/
sudo chmod 777 site-lisp
and then
brew link autoconf
and problem solve!
mac#Anna_mac : /usr/local/share/emacs : brew link autoconf
Linking /usr/local/Cellar/autoconf/2.69... 22 symlinks created

I had to run the following commands
chown -R yourusername /usr/local
chmod -R u+w /usr/local
brew link --overwrite autoconf

You just need to change brew owned by root.
then you can use below command.
sudo brew link xxxx
Quote from github, this is not a bug, it is designed:
jacknagel commented on 4 Feb 2012
brew install will not work with root privileges unless brew itself is
owned by root. #jacknagel Collaborator jacknagel commented on 4 Feb
2012
(this is by design.)

Related

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 

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

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.

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

/usr/local has correct permissions, but brew update still says it is not writable

Here are the permissions to my /usr/local directory: drwxr-xr-x.
I did sudo chown -R $user /usr/local, then did brew update again. It didn't work. I tried quitting terminal and opening a new session and trying again and I got the same thing. When I try brew doctor or brew update, it tells me that this directory is not writable. What do I do? What else do I need to be checking?
When I try to brew update Tip me Error: / usr/local must be writable!
sudo chgrp -R admin /usr/local
sudo chmod -R g+w /usr/local
The above method solves my problem
You need to run sudo chown -R $(whoami):admin /usr/local. Also note that in the command you ran $user should be capitalized: $USER.

Troubles uninstalling oh-my-zsh?

I'm on OSX and want to switch back to my original zsh config from oh-my-zsh, however when I run the uninstall script it gives me an error:
$ sudo uninstall oh-my-zsh
>> Preparing Uninstall...
Uninstall Began...
Uninstall Failed...
Reason: ErrorMissingBundle
Can anyone please tell me what this means? Thanks!
Have you tried just running the commands from uninstall script by hand? It's really straight forward: https://github.com/robbyrussell/oh-my-zsh/blob/master/tools/uninstall.sh. For the most part it just removes OMZ and attempts to restore a back up file:
rm -rf ~/.oh-my-zsh
rm ~/.zshrc
cp ~/.zshrc.pre-oh-my-zsh ~/.zshrc
source ~/.zshrc
In new version, just run uninstall_oh_my_zsh from the command-line.
See https://github.com/robbyrussell/oh-my-zsh#uninstalling-oh-my-zsh
Try
/usr/bin/chsh -s /bin/bash
rm ~/.zshrc
brew uninstall zsh --force
just run uninstall_oh_my_zsh
from here
https://github.com/robbyrussell/oh-my-zsh#uninstalling-oh-my-zsh
I was unable to uninstall directly since I was getting zsh:command rm not found
so I did the following:
/usr/bin/chsh -s /bin/bash
on terminal preference, I switched back to the default Login shell
and ran the below command
rm ~/.zshrc
brew uninstall zsh --force
simply use the following command:
/usr/bin/chsh -s /bin/bash