Mac - Can't Install HomeBrew because Curl is Missing - bash

I tried to install homebrew onto my mac, but I couldn't because curl wasn't found. I typed:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
This returned this error:
-bash: curl: command not found
So, I tried to install curl but apparently to install curl, I need to use curl? This is what I found:
Run in Terminal app:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" <
/dev/null 2> /dev/null
Run:
brew install curl
Done! You can now use curl.
However, this uses curl to install curl, so it gives the same error message: -bash: curl: command not found
TL;DR, how do I install curl on mac without using curl

I solved the problem!
To use bash on mac:
Go to terminal ––> preferences
Click on Shells open with: and set it to Command (complete path)
Enter one of the following:
/bin/bash
/bin/csh
/bin/zsh
/bin/zsh-4.0.4 (Mac OS X 10.2.8 or earlier)
/bin/zsh-4.1.1 (Mac OS X 10.3 or later)
/bin/ksh (Mac OS X 10.4 or later)
/bin/ksh worked for me
Source

I thought I broke my curl symlink somehow too, and somewhere in there I ran into your same issue, where no command would work. Somewhere in this mess, I fixed it.
https://brew.sh/
The main website requires you to install wget, maybe it gets deleted when you uninstall homebrew.
Regardless I found a way to install it using Ubuntu commands.
https://xmrig.com/docs/miner/build/ubuntu
but ran into an issue where I had to download cmake from the developer website and add it to the path in it's menu options on Mac OS X 10.11 to compile and run my program as ./program instead of program, then I installed macports(opened a new terminal window), and installed hwloc with macports, to no avail, just getting totally different errors.
I've also tried to add curl as an alias of curl into the bash profile and it recognized the error after I used this;
https://github.com/Homebrew/homebrew-core/issues/5084
However, I forgot I have an identical computer that is working just fine, but when I run "which curl", in the working computer, I get /usr/bin/curl, instead of /usr/local/bin/curl, so I ran
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/bin/curl"
I'm still getting the error, so I used vim, to sudo edit the /etc/paths file by using
sudo vim /etc/paths
i for edit
esc to exit edit mode
:x to save
Restart Terminal
Still getting a 403 SNI Error cannot download Python 3.9
rm -rf /opt/local/bin/curl
rm -rf /usr/local/bin/curl
which curl finally returns the correct path, /usr/bin/curl
exit
Restart Terminal
Still same error so I removed /usr/bin/curl from /etc/paths, and export file. Also deleted the bash profile, as the working computer doesn't return one, and...still the same error, so I conclude that "curl is not in path" should be ignored.
I did get brew doctor to return with no errors.
brew upgrade curl
curl not installed
brew install curl
403 Error SNI is required.
brew upgrade openssl
openssl 1.1.1j already installed

In my case, I made a mistake while editing my $PATH.
I would recommend looking at all your ~/.bash_profile and ~/.zshrc.
Remove ALL code related to $PATH. Carefully add things back in.

Related

Homebrew doesn't stay installed? M1 Macbook

I've upgraded to an M1 Macbook Pro and need to reinstall all of the goodies that I use regularly.
This includes Homebrew.
I have been to the official Homebrew site and done what they suggest:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
It then suggests to run
echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /Users/username/.bash_profile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/username/.bash_profile
eval "$(/opt/homebrew/bin/brew shellenv)"
To keep it within the path for future use - I would think this was the thing that keeps it being reusable when you restart/get a new Terminal
And this works great. I can then use brew install xxx after installation to install whatever packages I require.
The issue comes when I get a new Terminal or restart etc. I go to perform another brew install and I get the annoying
-bash: brew: command not found
Is there something that I've not done after the initial install that means my Mac doesn't remember it's installed brew?
I was running into the same issue as you. My issue was my terminal was set to bash instead of zsh by default. I had to run chsh -s /bin/zsh and followed the top answer on another post, which is similar if not identical to the steps you include in your question. I restarted my terminal and ran through brew help worked!

Mac OSX (Apple Silicon) Homebrew installed but brew cmd not found

I have googled around the error I was experiencing but from what I could tell this issue is likely related to how the path in which Homebrew is saved for Big Sur/Apple Silicon is different than other Macbook approaches.
Following the instructions on the Homebrew page, I ran the cURL command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
However, after the operation successfully completed, there was a warning in terminal:
warning: bin/opt/ path does not exist
And when I attempted to run a brew doctor the command was not found.
It's clear there is a pathing issue, but how do I solve it
In this case, I discovered it was a combination of a PATH issue as well as the .zshrc file was missing from the ~/ directory
I was able to resolve the issue with these steps.
Navigate to cd /opt/homebrew/bin/
Run export PATH=$PATH:/opt/homebrew/bin
Navigate back to "home" with cd ~/
in this directory I found that there was no .zshrc file (:scream:)
So I created a file with touch .zshrc and then
ran this command: echo export PATH=$PATH:/opt/homebrew/bin >> .zshrc
And after running that command, I was able to successfully use the brew doctor and other related commands!

Brew install class-dump doesn't work. How to fix it?

My mac is having MacOS 10.12.4 (Sierra). And I have installed homebrew using command line. This is what look like when I run "brew config" command.
Then I wanted to install class-dump using following command.
"brew install class-dump". But when it gives me following error. Can some one tell me the reason and what should I do?
I was able to solve the problem by installing class-dump manually without using home brew. I downloaded the class-dump in using this link. Then copy the class-dump file to the following location "/usr/local/bin". Then all works fine
Here is a one liner for the lazy people if you already have wget:
$ wget -qO- http://stevenygard.com/download/class-dump-3.5.tar.gz | tar xvz - -C /usr/local/bin

How to update cURL on OSX El Capitan?

I'm new using Mac and I'd like to upgrade the available cURL-7.43.0 to the last version cURL-7.47.1?
I'm looking at some pages, but they say to avoid upgrading the originals on OSX.
Any help please?
Thanks
Take a look at installing homebrew, it's a package manager that allow you to install and update binaries without overwriting your original ones.
You need then to prepend your PATH with homebrew's (/usr/local/bin by default).
If you don't when you run curl the system will fetch the default OSX one (/usr/bin/curl) which isn't updated.
Use which curl when you're done to check !
I had this issue as well with OSx locating curl at /usr/bin. If you install curl with brew install curl and then do brew info curl it will tell you the following near the bottom of the post-op output:
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> ~/.bash_profile
After running that command to update ~/.bash_profile you need to source it by executing . ~/.bash_profile

How do I update zsh to the latest version?

I recently switched to zsh on my Terminal.app on my OS X machine successfully. The version number of zsh is 4.3.11.
If you're using oh-my-zsh
Type omz update in the terminal
Note: upgrade_oh_my_zsh is deprecated
If you have Homebrew installed, you can do this.
# check the zsh info
brew info zsh
# install zsh
brew install --without-etcdir zsh
# add shell path
sudo vim /etc/shells
# add the following line into the very end of the file(/etc/shells)
/usr/local/bin/zsh
# change default shell
chsh -s /usr/local/bin/zsh
If you're not using Homebrew, this is what I just did on MAC OS X Lion (10.7.5):
Get the latest version of the ZSH sourcecode
Untar the download into its own directory then install: ./configure && make && make test && sudo make install
This installs the the zsh binary at /usr/local/bin/zsh.
You can now use the shell by loading up a new terminal and executing the binary directly, but you'll want to make it your default shell...
To make it your default shell you must first edit /etc/shells and add the new path. Then you can either run chsh -s /usr/local/bin/zsh or go to System Preferences > Users & Groups > right click your user > Advanced Options... > and then change "Login shell".
Load up a terminal and check you're now in the correct version with echo $ZSH_VERSION. (I wasn't at first, and it took me a while to figure out I'd configured iTerm to use a specific shell instead of the system default).
As far as I'm aware, you've got three options to install zsh on Mac OS X:
Pre-built binary. The only one I know of is the one that ships with OS X; this is probably what you're running now.
Use a package system (Ports, Homebrew).
Install from source. Last time I did this it wasn't too difficult (./configure, make, make install).
A simple script or execute following commands in terminal
# 1. download (currently the latest version is 5.8) and extract
wget https://sourceforge.net/projects/zsh/files/latest/download -O ./zsh-latest.tar.xz
mkdir zsh-latest
tar -xf zsh-latest.tar.xz -C zsh-latest --strip-components=1
cd zsh-latest
# 2. config, build, install
./configure
make -j4
sudo make install
which zsh
PS: If you fail to build, it probably due to missing necessary libraries. Just install libraries as the error message suggests. E.g, I didn't have ncurses:
sudo apt install ncurses-devel # for Ubuntu
sudo yum install ncurses-devel # for CentOS/Redhat
omz update gave me following error:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
This is an issue with git, where after upgrading to Mac OS Ventura (13.0.1). git command gave me above error.
Solution:
Download and install the 'Command Line Tools' package to fix 'git'
xcode-select --install
This will pop a dialogue box. Select "Install".
More details here: https://apple.stackexchange.com/a/254381
omz update worked successfully after this for me
I just switched the main shell to zsh. It suppresses the warnings and it isn't too complicated.

Resources