问题
As described on the homebrew site (https://brew.sh/) this should be pretty straightforward, just open the terminal, paste and run. However, somehow it is not working for me and now a couple of hours in, I am getting very frustrated.
I am a rookie and suspect this is some easy fix thing, so I would appreciate some help. I am on macOS Catalina, using zsh, and when I paste and run nothing happens, the cursor goes to the next line, and I can type, but nothing runs, no feedback. Which I understand is what happens when the command makes no sense. Instead I should be prompted very quickly to hit Return and continue with the installation.
I made sure the quotes are not changed, I tried using Bash, but somehow it’s not working. (Installed the command line tools as well).
Out of frustation I tried the alternative way described on the site (not sure I took the right steps):
- cd /usr/local
- pasted and ran:
mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
In this case, I did get a directory called homebrew in /usr/local/homebrew
But brew was not added to /bin, so the command was not found when trying to run it. I deleted the homebrew dir as I figured solving this might’ve been more complicated.
I also ended up doing most of the things I found online about modifying the PATH, and using sudo but these only seemed to make things worse (had to reset my mac because something I did made it unusable after working smoothly)
If anyone can give me a hand I would really appreciate it.
回答1:
The command in your question contains three parts:
mkdir homebrewwill create a new directory with the name "homebrew".curl -L https://github.com/Homebrew/brew/tarball/masterwill download the brew tarball from the Github repository.- the pipe
|character will redirect the output of thecurlcommand to the followingtarcommand:tar xz --strip 1 -C homebrewwhich will extract the tarball into thehomebrewdirectory you created in step 1.
if you run this command in a directory that you have write permissions in. then your installation should be successful.
you should find the brew binary in the homebrew/bin/ directory and if you cd into the homebrew/bin/ directory you can execute brew commands with ./brew install ... for example.
However the brew command won't be available everywhere because it's not in your PATH, to make it available everywhere you can add it to your PATH in your zsh profile:
open
~/.zshrc.add this line at the end of the file:
export PATH="/path/to/hombrew/bin:$PATH";save and close the file.
run
source ~/.zshrcor start a new terminal session and you should be good to go.
来源:https://stackoverflow.com/questions/62753234/somehow-i-can-t-instal-homebrew