简体   繁体   中英

Why have symbolic links between files in folders at same depth?

I noticed that on OS X, the /usr/local/Cellar folder contains binaries installed using Homebrew, and that /usr/local/opt has symbolic links to a bunch of those binaries. I haven't used symbolic links much, but as I understand it, the purpose of them is to create a link in a convenient location to a file/folder that acts as a copy of that file/folder, without having to move that file/folder from its original location.

So my questions are :

1) Am I correct in my understanding of symbolic links there? ^^

2) If so ^^, why would you create symbolic links in one folder ( /usr/local/opt ) to binaries in another folder ( /usr/local/Cellar ) that is at a similar location/depth in the file structure? Under what circumstances would you use these symbolic links where you couldn't just use the binaries?

Thanks!

Homebrew wants to keep things organized, therefore installing all its packages in one place (the cellar). Certain files of the tools you install with Homebrew are expected to be in certain places (eg in /usr/local/opt ). A symbolic link is used here so when you update the Homebrew package in the cellar, the files linked in /usr/local/opt are also referring to the same updated version.

Also see the Homebrew FAQ for some info on the cellar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM