What does “brew link” do?

后端 未结 2 1192
迷失自我
迷失自我 2020-12-12 23:42

When I run brew doctor I get the common warning:

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble          


        
2条回答
  •  情书的邮戳
    2020-12-12 23:50

    Homebrew can allow multiple versions of a formula to be installed. For example, there is formulae called node and node@10 and similar.

    $ brew info node@10
    ...
    ==> Caveats
    node@10 is keg-only, which means it was not symlinked into /usr/local,
    because this is an alternate version of another formula.
    

    If I have both node and node@10 installed, where node is at v11. I can decide later to active the earlier version with brew link:

    $ brew unlink node
    
    $ brew link node@10
    
    $ cd /urs/local/bin
    $ ls -l node
    lrwxr-xr-x  1 user  admin  34 12 Dec 20:07 node -> ../Cellar/node@10/10.14.1/bin/node
    

    Here the symlink node is pointing to an earlier version (keg-only) installed in Cellar.

提交回复
热议问题