What are the different directories of an Homebrew installation (/usr/local/...) for - homebrew

I am trying to get a hold of the structure of my Homebrew setup and would like to know what these different directories in /usr/local are for:
/usr/local/bin
/usr/local/Caskroom
/usr/local/Cellar
/usr/local/etc
/usr/local/Frameworks
/usr/local/Homebrew
/usr/local/include
/usr/local/lib
/usr/local/opt
/usr/local/remotedesktop
/usr/local/sbin
/usr/local/share
/usr/local/var
Homebrew
contains the Homebrew app
Cellar
contains all the racks someone installs through Homebrew. A rack contains the different versions of an application
But the rest: bin, etc, Framworks, include, lib, ...?

Many of these directories are part of the Filesystem Hierarchy Standard, and so have a standardised purpose regardless of the fact that you're using Homebrew.
My answer is based mainly from hier(7) for directories that both macOS and Linux share, and the MacPorts wiki for more macOS specific answers.
🖥 Non-Homebrew Specific
/usr/local/bin
This is where your standard executable files are stored. e.g. When you type vim into the terminal, the file that's run is stored here.
/usr/local/etc
These are local configuration files. Shell completion files are examples of this (when you hit tab to autofill a command's options).
/usr/local/include
This is where header files are stored that are used by C programs. These contain pre-defined functions.
/usr/local/lib
Object libraries are stored here.
/usr/local/opt
This contains static files, including licenses, READMEs, and install receipts.
/usr/local/sbin
These are executable files that which aren't normally run by standard users. e.g. System programs and administration utilities.
/usr/local/share
This folder contains architecture-independent files. Examples might include documentation and man pages.
/usr/local/var
Files which may change in size can be stored here. Log files are a good example.
🍎 macOS Specific
/usr/local/Frameworks
This is for native macOS frameworks. Python makes use of this for storing the Python app and executable.
/usr/local/remotedesktop
I'm guessing that this stores files from Apple Remote Desktop.
🍺 Homebrew Specific
/usr/local/Caskroom
This directory contains named casks (i.e. applications) e.g. Firefox, Telegram. See the Homebrew terminology page for more information.

Related

Different color folder in usr/local/bin

I'm using iterm2 and looking at what is in usr/local/bin. Some apps were installed with homebrew. Others i'm not sure how they got there. Most of the folders are purple. Some are red. So ex: meteor and wireshark are red. I cannot figure out the meaning of this.
The default ls colorscheme on macOS shows executable files as red and symbolic links as purple.
Homebrew organize its installed packages under specific directories that look like /usr/local/Cellar/<name>/<version>. In order to make them discoverable by the rest of the system, it creates symbolic links from standard locations such as /usr/local/bin to those directories.
Hence, the symbolic links (in purple) you see in that directory were very likely installed by Homebrew; while executable files (in red) were installed by other means.
You can have a more detailed view by using ls -l. Among other things, it’ll tell you the target of each symbolic link. If you see something like foo -> ../Cellar/bar/1.2.3/bin/foo, that’s something installed by Homebrew.

Preventing nix-env -i from installing $out/lib in the user-environment

Is it possible to prevent the contents of lib/ in a derivation from getting installed in the active user-environment? The package in question has an internal lib/ folder which should not be exposed to users, nor clutter the environment. As far as I have been able to discern, the links in user-environment are updated from within the nix-env binary.
I found a solution. Instead of installing in $out, one can install in $out/pkg, and then create the appropriate links in $out. This prevents nix-env from finding lib/ (amongst other things).

Homebrew formula how and where to place media files needed by executables in /bin

First homebrew formula, trying to migrate a primarily Python project from disutils to homebrew as it now requires quite a lot more than just python modules.
I've written a cli, in python, that needs access to template files, a some media files like fonts and images.
My directory structure (in the repository) looks like this:
/klibs
/bin
klibs # the cli
/lib
/font
/img
/template
/klibs
__init__.py # and the rest of the custom module
If I understand things right, to install the CLI I simply need:
bin.install("bin/klibs")
But that program needs access to everything in lib. I broadly understand that I just need to install that lib folder somewhere (...though specifically, I don't fully understand where...) inside Cellar and then symlink it. But I don't understand how this is achieved, or perhaps how it's best achieved as per homebrew cannon.
Lil help?

what is the standard ada include path

Im using gnat4.6 on Ubuntu installed using apt-get. I need to know where to install downloaded libraries like APQ. What should I set my ADA_INCLUDE_PATH and ADA_OBJECTS_PATH to?
The beauty of Ada support in Debian (on which Ubuntu is based) is that you don't need to mess with ADA_INCLUDE_PATH and friends; supported libraries are installed where the GNAT Project Manager expects to find them. Say gnatls -v to see the default values.
To use the system as intended, you will find it much simpler to use the GNAT Project Manager; you'd say, in your my_project.gpr file,
with "apq";
project My_Project is
...
and build with
$ gnatmake -P my_project
There's online documentation for GPR, but I wouldn't call it particularly user-friendly. There's a set of Youtube videos (I haven't looked at them in any detail; their stated interest is large systems, but hang in there).
I use gnatmake to build; how do I cite my build paths in a correct way?
The relevant options are shown in 6.2 Switches for gnatmake: Source and library search path switches.
Addendum: The development package is libapq3.2.0-dev.
The manual is in /usr/share/doc/libapq3.2.0-dev/manual.pdf.gz
An example and corresponding .gpr file are in /usr/share/doc/libapq3.2.0-dev/examples. As #Simon suggested, the .gpr file begins:
with "apq.gpr";
project APQ.Samples is
The Ada include files are in /usr/share/ada/adainclude/apq.
The libraries are in /usr/lib.
$ dpkg -L libapq3.2.0-dev
/.
/usr
/usr/share
/usr/share/ada
/usr/share/ada/adainclude
/usr/share/ada/adainclude/apq
/usr/share/ada/adainclude/apq/apq_helper.ads
/usr/share/ada/adainclude/apq/apq_helper.adb
/usr/share/ada/adainclude/apq/apq.adb
/usr/share/ada/adainclude/apq/apq.ads
/usr/share/ada/adainclude/apq.gpr
/usr/share/doc
/usr/share/doc/libapq3.2.0-dev
/usr/share/doc/libapq3.2.0-dev/copyright
/usr/share/doc/libapq3.2.0-dev/manual.pdf.gz
/usr/share/doc/libapq3.2.0-dev/examples
/usr/share/doc/libapq3.2.0-dev/examples/apq-samples.adb
/usr/share/doc/libapq3.2.0-dev/examples/apq-samples.ads
/usr/share/doc/libapq3.2.0-dev/examples/apq-samples.gpr
/usr/lib
/usr/lib/libapq.a
/usr/lib/ada
/usr/lib/ada/adalib
/usr/lib/ada/adalib/apq
/usr/lib/ada/adalib/apq/apq_helper.ali
/usr/lib/ada/adalib/apq/apq.ali
/usr/share/doc/libapq3.2.0-dev/changelog.Debian.gz
/usr/lib/libapq.so

Add/Find Style files in/to latex

Question 1
I am getting the following error in Latex:
! LaTeX Error: File `fancybox.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
Enter file name:
However, the file fancybox.sty is actually located in the folder from where I am running the pdflatex command. Why is not able to find it?
I just installed Latex on Ubuntu using the command
apt-get install texlive-latex-base
and the pdflatex command works.
Question 2
I want to install this texments from CTAN. Can I do this through apt-get? Is there another Easy way?
Thanks,
Ajay G.
The fancybox LaTeX package is included in the texlive-latex-extra package for Ubuntu. If you install the texlive-latex-extra package using Synaptic or apt-get, your document should compile:
$ sudo apt-get install texlive-latex-extra
A couple other things that may help you in the future:
The TeXLive installation in Ubuntu is currently the 2007 edition. The 2009 edition of TeXLive was just released recently (see the TeXLive website for downloads). The 2007 edition will work most of the time, but the 2009 edition contains the latest version of the packages with their bug fixes. Just a heads-up.
I'd recommend installing the full set of TeXLive package under Ubuntu so that you don't have to dig through the repository and install new files each time you want to add a new \usepackage line to your .tex file. If you install the texlive-full package, that'll cover all the bases:
$ sudo apt-get install texlive-full
Note, however, that the full TeXLive package set is a large download and will take some time to install.
Try
apt-file -x search '/fancybox.sty$'
and you may get the answer like:
texlive-latex-recommended: /usr/share/texmf-texlive/tex/latex/fancybox/fancybox.sty
so "texlive-latex-recommended" is the right package to install.
Have you tried manually as it says in the official Ubuntu documentation?
https://help.ubuntu.com/community/LaTeX
If a package you desire is not in Ubuntu's repositories, you may look on CTAN's web site or TeX Catalogue Online to see if they have the package. If they do, download the archive containing the files. In this example, we'll install example package foo, contained in foo.tar.gz.
Once foo.tar.gz has finished downloading, we unzip it somewhere in our home directory:
tar xvf foo.tar.gz
This expands to folder foo/. We cd into foo/ and see foo.ins. We now run LaTeX on the file:
latex foo.ins
This will generate foo.sty. We now have to copy this file into the correct location. For the purposes of this example, we will copy this into our personal texmf tree. The advantages of this solution are that if we migrate our files to a new computer, we will remember to take our texmf tree with us, resulting in keeping the same packages we had. The disadvantages are that if multiple users want to use the same packages, the tree will have to be copied to each user's home folder.
We'll first create the necessary directory structure:
cd ~
mkdir -p texmf/tex/latex/foo
Notice that the final directory created is labeled foo. It is a good idea to name directories after the packages they contain. The -p attribute to mkdir tells it to create all the necessary directories, since they don't exist. Now, using either the terminal, or the file manager, copy foo.sty into the directory labeled foo.
Now, we must make LaTeX recognize the new package:
texhash ~/texmf
The new package should now be installed. To use it in your LaTeX document, merely insert \usepackage{foo} in the preamble.
It should work with the style file in the directory from where you were running the pdflatex command, but a solution to this problem is simple:
sudo cp *.sty /usr/share/texmf-texlive/tex/latex/base/
sudo mktexlsr

Resources