Can't install Homebrew on Catalina - homebrew

I have both Xcode and command line tool installed. I am trying to install Homebrew on Catalina.
Its not installing this is what I get
==> /usr/bin/sudo /bin/mkdir -p /usr/local/bin
mkdir: /usr/local/bin: Not a directory
Failed during: /usr/bin/sudo /bin/mkdir -p /usr/local/bin
What should I do?

On terminal, just run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Related

How to uninstall Homebrew of Rosetta and install Homebrew native on Mac Bigsu (M1)

Previously I have installed Homebrew rosetta version on MacOs M1,
now I see HomeBrew has native version, So how do I remove HomeBrew on rosetta and install the native version.
Please help me with this problem, Thanks
Uninstall Rosetta version of Homebrew
Run in rosetta mode inside terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
Then install natively inside the terminal (without rosetta):
(with help of https://www.youtube.com/watch?v=nv2ylxro7rM)
cd /opt
sudo mkdir homebrew
sudo chown -R $(whoami) /opt/homebrew
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
(Add the Homebrew bin directory to the PATH if you are using zsh)
echo "export PATH=/opt/homebrew/bin:$PATH" >> ~/.zshrc

Homebrew: untar anywhere and install formula: Error: The following directories are not writable by your user

Following the official Homebrew installation instructions to "untar anywhere":
$ homebrew_dir="$HOME"/homebrew_for_lunch_and_learn
$ mkdir "$homebrew_dir" && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C "$homebrew_dir"
Then attempting to build on top of these instructions for convenience:
$ sudo ln -s "$homebrew_dir"/bin/brew /usr/local/bin/lunchbrew
Then attempting to install something:
$ lunchbrew install python3
...
Error: The following directories are not writable by your user:
/usr/local/include
/usr/local/lib
/usr/local/lib/pkgconfig
...
Or something else:
$ lunchbrew install vim
...
Error: The following directories are not writable by your user:
/usr/local/include
/usr/local/lib
/usr/local/lib/pkgconfig
...
Try this instead:
$ ~/homebrew_for_lunch_and_learn/bin/brew install python3
(success...)
or this:
$ alias lunchbrew="~/homebrew_for_lunch_and_learn/bin/brew"
$ lunchbrew install vim
(success...)
Why this works:
It appears that Homebrew cares about the directory of the symlink. The symlink lives at /usr/local/bin/lunchbrew in /usr/local/. That appears to be why it wants the /usr/local/ directories to be writable.

Makefile:273: recipe for target 'install' failed make: *** [install] Error 1 in ubuntu16.04 in Docker container

I am using Docker container in which i install ubuntu16.04 , i tried to install setup of openvino toolkit so i got the following error when I Install Paho* MQTT C client libraries by following command given in https://github.com/intel-iot-devkit/people-counter
root#2fe5f8678637:~# cd paho.mqtt.c
root#2fe5f8678637:~/paho.mqtt.c# ls -a
. CODE_OF_CONDUCT.md .git src
.. conanfile.py .gitignore test
about.html CONTRIBUTING.md .gitreview test_package
android .cproject LICENSE travis-build.sh
appveyor.yml debian Makefile travis-deploy.sh
build deploy_rsa.enc notice.html travis-env-vars
build.xml dist .project travis-install.sh
cbuild.bat doc .pydevproject travis-macos-vars
cmake edl-v10 README.md travis-setup-deploy.sh
CMakeLists.txt epl-v10 .settings .travis.yml
root#2fe5f8678637:~/paho.mqtt.c# make
mkdir -p build/output/samples
mkdir -p build/output/test
echo OSTYPE is Linux
OSTYPE is Linux
root#2fe5f8678637:~/paho.mqtt.c# sudo make install
mkdir -p build/output/samples
mkdir -p build/output/test
echo OSTYPE is Linux
OSTYPE is Linux
mkdir -p /usr/local/include
install -m 644 build/output/libpaho-mqtt3c.so.1.0 /usr/local/lib
install -m 644 build/output/libpaho-mqtt3cs.so.1.0 /usr/local/lib
install -m 644 build/output/libpaho-mqtt3a.so.1.0 /usr/local/lib
install -m 644 build/output/libpaho-mqtt3as.so.1.0 /usr/local/lib
install build/output/paho_c_version /usr/local/bin
install build/output/samples/paho_c_pub /usr/local/bin
install build/output/samples/paho_c_sub /usr/local/bin
install build/output/samples/paho_cs_pub /usr/local/bin
install build/output/samples/paho_cs_sub /usr/local/bin
/sbin/ldconfig /usr/local/lib
ln -s libpaho-mqtt3c.so.1 /usr/local/lib/libpaho-mqtt3c.so
ln: failed to create symbolic link '/usr/local/lib/libpaho-mqtt3c.so': File exists
Makefile:273: recipe for target 'install' failed
make: *** [install] Error 1
Can someone explain what that error means and how to resolve it?
From the documentation:
ln [OPTION]... TARGET... DIRECTORY
So if your target is /usr/local/lib/libpaho-mqtt3c.so, you should use it the other way around, like this:
ln -s /usr/local/lib/libpaho-mqtt3c.so libpaho-mqtt3c.so.1

Installing brew on Mac 10.6 results in syntax error

Running the following command from http://brew.sh/:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
...result in:
-e:192: syntax error, unexpected '.', expecting $end
.map { |d| File.join(HOMEBREW_PREFIX, d) }
^
I'm using zsh on Mac OS 10.6.
ok so to install manually through terminal do
$ cd /usr/local
$ mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
then you need to change your bash_profile like this:
$ echo 'export PATH="/usr/local/homebrew/bin:$PATH"' >> ~/.bash_profile
you might need to change permissions to the homebrew folder as well:
$ sudo chown -R $(whoami) /usr/local/homebrew
this worked for me
The official homebrew install command use some bashism. The easiest way to solve this is to run the homebrew install command with bash -c in front of it :
bash -c '/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
Fast forward to 2020 and homebrew is no longer ruby based, but bash-based. Also, it officially only supports 10.13 or higher, while keeping an eye out for 10.9 users.
The new way to get homebrew on 10.6 or lower is by using TigerBrew:
https://github.com/mistydemeo/tigerbrew
This is a maintained fork of homebrew, with the purpose of offering support for 10.4-10.7.
After installing tigerbrew, install a newer curl: brew install curl.
That should fix any ssl issues.

How to uninstall homebrew?

I installed homebrew today without really knowing what I was doing, and now my scikit-learn package is broken. I want to undo everything that I did by uninstalling homebrew, and tried following the tips here:
https://github.com/Homebrew/homebrew/wiki/FAQ
However, I think homebrew installed into /usr/bin/local, and not /usr/bin/, so I'm not sure I can use the instructions in the link.
When I initially installed homebrew (ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"), I got the following messages:
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
==> The following directories will be made group writable:
/usr/local/lib/pkgconfig
/usr/local/share/man/man3
/usr/local/share/man/man5
/usr/local/share/man/man7
Can I just delete the files in
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
I'm terrified of screwing something up in the uninstallation process.
Incidentally, would uninstalling homebrew even restore my system to what it was before? How would I go about doing that?
This worked for me
Official brew uninstalling steps:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
But /usr/bin/ruby is just symlink in order to find your ruby you need to type
which ruby
Which will give you /snap/bin/ruby
So then just use this :
/snap/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
This is covered in the homebrew FAQ:
https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/FAQ.md#how-do-i-uninstall-homebrew
It specifies a script you can run to do it. You should run that script. As of right now, the script says something like:
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e
/usr/bin/which -s git || abort "brew install git first!"
test -d /usr/local/.git || abort "brew update first!"
cd `brew --prefix`
git checkout master
git ls-files -z | pbcopy
rm -rf Cellar
bin/brew prune
pbpaste | xargs -0 rm
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions
test -d Library/LinkedKegs && rm -r Library/LinkedKegs
rmdir -p bin Library share/man/man1 2> /dev/null
rm -rf .git
rm -rf ~/Library/Caches/Homebrew
rm -rf ~/Library/Logs/Homebrew
rm -rf /Library/Caches/Homebrew
Just run this code in terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Run this in the cli:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
The is the updated recommended way
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
You may gout output like this:
The following possible Homebrew files were not deleted:
/opt/homebrew/Frameworks/
/opt/homebrew/bin/
/opt/homebrew/etc/
/opt/homebrew/include/
/opt/homebrew/lib/
/opt/homebrew/opt/
/opt/homebrew/sbin/
/opt/homebrew/share/
/opt/homebrew/var/
You may wish to remove them yourself.
To remove run:
sudo rm -rf /opt/homebrew
Clean as a whistle! 😚

Resources