Somehow I can’t instal Homebrew

假装没事ソ 提交于 2020-07-10 10:26:29

问题


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:

  1. mkdir homebrew will create a new directory with the name "homebrew".
  2. curl -L https://github.com/Homebrew/brew/tarball/master will download the brew tarball from the Github repository.
  3. the pipe | character will redirect the output of the curl command to the following tar command: tar xz --strip 1 -C homebrew which will extract the tarball into the homebrew directory 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:

  1. open ~/.zshrc.

  2. add this line at the end of the file:

    export PATH="/path/to/hombrew/bin:$PATH";
    
  3. save and close the file.

  4. run source ~/.zshrc or start a new terminal session and you should be good to go.



来源:https://stackoverflow.com/questions/62753234/somehow-i-can-t-instal-homebrew

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!