Using "brew rmtree --dry-run <formula>" get unexpected result - homebrew

I've installed brew rmtree with brew tap beeftornado/rmtree. But when I want to see what will be removed with dry-run, I get this unexpected result (for example with graphviz):
This is a dry-run, nothing will be deleted
Usage: brew uses [options] formula [...]
Show formulae and casks that specify formula as a dependency; that is, show
dependents of formula. When given multiple formula arguments, show the
intersection of formulae that use formula. By default, uses shows all
formulae and casks that specify formula as a required or recommended
dependency for their stable builds.
--recursive Resolve more than one level of dependencies.
--installed Only list formulae and casks that are
currently installed.
--include-build Include all formulae that specify formula
as :build type dependency.
--include-test Include all formulae that specify formula
as :test type dependency.
--include-optional Include all formulae that specify formula
as :optional type dependency.
--skip-recommended Skip all formulae that specify formula as
:recommended type dependency.
--formula, --formulae Include only formulae.
--cask, --casks Include only casks.
-d, --debug Display any debugging information.
-q, --quiet Make some output more quiet.
-v, --verbose Make some output more verbose.
-h, --help Show this message.
Error: invalid option: --dry-run

Related

How can I create home-nix file from my current configuration

What I think that I've understood about home-manager.
Instead of using
nix-env iA packageToBeInstalled
you write a list of package in a file (/home/nixos/.config/nixpkgs/home.nix that I from now on call just home.nix)
you run
home-manager switch
and the package are installed.
But I have already installed some packages with nix-env. (home-manager for instance)
I would like to have my configuration save just in home.nix in order to just have to import it and execute home-manager switch to import the exact same configuration in a other OS.
Therefore I need a command replicating my configuration in home.nix.
I am not aware of a tool that fully automates this.
The nix-env list of installed packages is maintained in ~/.nix-profile/manifest.nix, but does not contain the attribute path, which is the "name" you need to use in such configuration files.
To find the attribute paths for the things you've installed, you may first create an index of sorts based on your current nixpkgs (NIX_PATH etc):
nix-env -qaP >packages.tmp
and then use it to look up each package.
Here's a one-liner that doesn't work for all packages.
nix-env -q | while read name; do grep "$name" <packages.tmp; done
So make sure to read through nix-env -q yourself and look up anything that's missing using for example https://search.nixos.org/packages.
To finalize, remove the imperatively installed packages with nix-env -e, check nix-env -q, and rm packages.tmp.

Why do I need `brew link --overwrite <formula.rb>`?

I've written a brew formula (below) for xnec2c but I get this error. What about the xnec2c installer is causing brew to bark about the installation process? I'm the maintainer for xnec2c so we can change the ./configure or make install process as necessary. This is brew for Linux (on Ubuntu 20.04) and ultimately I would like to see if it runs on OSX, too!
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /home/linuxbrew/.linuxbrew
Could not symlink share/mime/XMLnamespaces
Target /home/linuxbrew/.linuxbrew/share/mime/XMLnamespaces
already exists. You may want to remove it:
rm '/home/linuxbrew/.linuxbrew/share/mime/XMLnamespaces'
To force the link and overwrite all conflicting files:
brew link --overwrite xnec2c
To list all files that would be deleted:
brew link --overwrite --dry-run xnec2c
Possible conflicting files are:
/home/linuxbrew/.linuxbrew/share/mime/XMLnamespaces
/home/linuxbrew/.linuxbrew/share/mime/aliases
/home/linuxbrew/.linuxbrew/share/mime/generic-icons
/home/linuxbrew/.linuxbrew/share/mime/globs
/home/linuxbrew/.linuxbrew/share/mime/globs2
/home/linuxbrew/.linuxbrew/share/mime/icons
/home/linuxbrew/.linuxbrew/share/mime/magic
/home/linuxbrew/.linuxbrew/share/mime/mime.cache
/home/linuxbrew/.linuxbrew/share/mime/subclasses
/home/linuxbrew/.linuxbrew/share/mime/treemagic
/home/linuxbrew/.linuxbrew/share/mime/types
/home/linuxbrew/.linuxbrew/share/mime/version
Note that it does work if I run brew link --overwrite xnec2c but I'd like the formula to install cleanly!
Here is the formula:
class Xnec2c < Formula
desc "Multi-threaded EM tool based on NEC2 to model antenna radiation patterns"
homepage "https://www.xnec2c.org/"
url "https://www.xnec2c.org/releases/xnec2c-v4.4.12.tar.gz"
sha256 "e98af1e8b9098df9cc03f90950358b846cc6a2965e79c0114ab711fbe51272c5"
license "GPL-3.0-or-later"
depends_on "atk"
depends_on "cairo"
depends_on "gdk-pixbuf"
depends_on "glib"
depends_on "gtk+3"
depends_on "librsvg"
depends_on "pango"
depends_on "autoconf"
depends_on "automake"
def install
system "./autogen.sh"
system "./configure", *std_configure_args
system "make"
system "make install"
system "make desktop-install"
end
test do
system "#{bin}/xnec2c", "-h"
end
end
Because you have a conflict in the setup, that is why you brew link <formula>. Ideally, we also have conflicts_with semantics in the formula to surface that.
This is all the conflicts in the homebrew-core repo, https://github.com/search?q=repo%3Ahomebrew%2Fhomebrew-core+conflicts_with&ref=opensearch&type=code

Trouble with HomeBrew

I'm having trouble searching for the list of all casks when I run the command for it.
brew search --casks
I get the error you see in the picture.
Error: Invalid usage: This command requires at least 1 text or regex argument.
If anyone has had similar problems please share.
You need at least one string to search for.
$ brew search --casks fire
==> Casks
firefly firealpaca firestorm
firefox-beta firebase-admin firestormos
firefox-developer-edition firebird-emu fireworks
firefox-esr firecamp multifirefox
firefox-nightly firefox ✔ spitfire-audio
If you really need to find all available casks, you can use an empty arg like this:
brew search --casks ''

Anyone else get this error "Error: invalid option: --with-passenger"

Can not get NGINX to install with passenger
Following the steps you are supposed to...
brew install passenger
Then you run the following command...
brew install nginx --with-passenger
But I get:
Error: invalid option: --with-passenger
Could not find any resources about this online, so asking here.
$ brew install nginx --with-passenger
Usage: brew install [options] formula
Install formula.
formula is usually the name of the formula to install, but it can be specified
in several different ways.
-d, --debug If brewing fails, open an interactive
debugging session with access to IRB or a
shell inside the temporary build directory
--env If std is passed, use the standard build
environment instead of superenv.If super
is passed, use superenv even if the formula
specifies the standard build environment.
--ignore-dependencies Skip installing any dependencies of any
kind. If they are not already present, the
formula will probably fail to install.
--only-dependencies Install the dependencies with specified
options but do not install the specified
formula.
--cc Attempt to compile using provided
compiler. compiler should be the name
of the compiler's executable, for instance
gcc-7 for GCC 7. In order to use LLVM's
clang, use llvm_clang. To specify the
Apple-provided clang, use clang. This
parameter will only accept compilers that
are provided by Homebrew or bundled with
macOS. Please do not file issues if you
encounter errors while using this flag.
-s, --build-from-source Compile the specified formula from source
even if a bottle is provided. Dependencies
will still be installed from bottles if
they are available.
--force-bottle Install from a bottle if it exists for the
current or newest version of macOS, even if
it would not normally be used for
installation.
--include-test Install testing dependencies required to
run brew test.
--devel If formula defines it, install the
development version.
--HEAD If formula defines it, install the HEAD
version, aka. master, trunk, unstable.
--fetch-HEAD Fetch the upstream repository to detect if
the HEAD installation of the formula is
outdated. Otherwise, the repository's HEAD
will be checked for updates when a new
stable or development version has been
released.
--keep-tmp Don't delete the temporary files created
during installation.
--build-bottle Prepare the formula for eventual bottling
during installation.
-f, --force Install without checking for previously
installed keg-only or non-migrated
versions.
-v, --verbose Print the verification and postinstall
steps.
--display-times Print install times for each formula at the
end of the run.
-i, --interactive Download and patch formula, then open a
shell. This allows the user to run
./configure --help and otherwise
determine how to turn the software package
into a Homebrew package.
-g, --git Create a Git repository, useful for
creating patches to the software.
-h, --help Show this message.
Error: invalid option: --with-passenger
This is supposed to work... so yeah.
A late answer. Obviously the documentation on the passenger site is outdated at time of this writing.
According to phusion's github site
https://github.com/phusion/passenger/issues/2187#issue-416881033
the config option --nginx-with-passenger is not valid anymore.
Instead do:
brew install nginx passenger
Addendum:
When using google search for results currently the old page comes up at the top of the list. Here's the currently maintained page with the accurate information:
https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/nginx/install/oss/osx.html

Enumerating formulas for Homebrew and Macports

I am trying to count the total number of homebrew formulas. I've done a wildcard search and directed the output to a text file and counted the lines using brew search /.*/ | wc -l.
This produces only 3,142 formulas, 1/5 the number I found for Macports. However, I've noticed that Macports also has a lot of duplicate packages, listing both the meta package and it's various dependent packages. Is there a way to break out those dependent packages in Homebrew? What about Macports, is there a way to filter out the number of redundant dependent packages?
Finally, is there a way to force Homebrew to list versions?
You should be comparing the number of MacPorts source packages to Homebrew. For example
tar tf /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports.tar | grep Portfile | wc -l
Maybe there is a better way.
To get a list of package versions in Homebrew, you can try something like this:
for formula in $(brew search); do brew info $formula | grep "^$formula"; done

Resources