This seems like a very noob question but I can't find an answer anywhere!
I'm very new to developing packages for Homebrew but when I edit my formula and come to update my package I get the following error
Error: SHA256 mismatch
My question is, how do I generate the expected SHA256 value?
After editing the formula, you can run brew fetch your-formula --build-from-source to fetch the tarball and display the new checksum. If you've already downloaded the tarball somewhere, you can calculate the hash with openssl sha256 < some_tarball.tar.gz or shasum -a 256 some_tarball.tar.gz.
For casks, I prefer to change the cask sha256 to something wrong and then run brew cask fetch {caskName}, which then throws an error that shows the "Actual" sha256 for the downloaded file. You can just copy and paste that.
Related
I'm very inexperienced, and was following directions here ---
Installing ifuse with Homebrew results in ERROR message
I believe I made some unintended changes when I was editing the file in
$ vi `brew formula ifuse`
without understanding what I was doing. When I went to install ifuse, it just give me an error. Is there any way to get back to the original file/undo my edits?
Homebrew formulas are in a local git repository. You can restore the original formula by typing:
cd `brew --prefix`/Library/Taps/homebrew/homebrew-core/Formula
git checkout ifuse.rb
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 ''
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
Is there a way to brew link just those files without conflicts?
As near as I can tell, the only options are to force an overwrite of all conflicting roles, or to link no files at all. For example I have an existing compare that I need to keep, but need ImageMagick's convert. When I brew install imagemagick I get
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/compare
Target /usr/local/bin/compare
already exists. You may want to remove it:
rm '/usr/local/bin/compare'
To force the link and overwrite all conflicting files:
brew link --overwrite imagemagick
To list all files that would be deleted:
brew link --overwrite --dry-run imagemagick
Possible conflicting files are:
/usr/local/bin/compare -> /Applications/Araxis Merge.app/Contents/Utilities/compare
But the only way offered to proceed is either to leave all of ImageMagick unlinked, or to overwrite my existing compare.
How do I brew link everything but the existing compare? Is there a way to install only convert perhaps?
Here's a shell function I wrote to do this (for the zsh that's now standard on macOS, but it will run on Bash with small adjustments 1):
local targetdir
targetdir=($(brew --cellar $1)/*/bin) || return
local linksdir=$(brew --repo)/bin
for ex in "$targetdir"/*(^/) # files (and symlinks), not subdirectories
do
local exname=${ex##*/}
if builtin which "$exname" &>/dev/null
then
echo " $exname already available in the path - skipped"
else
ln -s "$ex" "$linksdir/" && echo "$exname linked from $linksdir"
fi
done
I saved it as a shell function called blink and when I call it with a package name, like
blink binutils
it symlinks only the binaries whose names aren't already available in the $PATH.
1The adjustments to make it work on Bash: remove the final (^/) form the for ex... line, and the builtin 3 lines further down.
So I have a few homebrew packages that I maintain. When I release a tagged version of one of the packages, I have a cumbersome dance that I have to do in order for the whole process to work end to end. It is as follows:
Update package and tag with new version number
Push to github
Update the URL in my homebrew formula to the new tag
Push formula to github
brew upgrade [package]
when it gives me the sha256 error I copy and paste the Actual sha256 into the formula file and push it again up to github.
problem solved
Bellow is the error I get when I brew upgrade [package]
Error: SHA256 mismatch
Expected: f95ec88f22bd217271199695593f9a217cc0fc3b69469e31cafd09f0a55dc1a4
Actual: 3b52516206cdec8fd85f74c5d346665195fdef3095dc7665a680e48842edd5cf
I have tried to generate the sha256 locally before I commit the formula to github and it never matches:
shasum -a 256 [package]
I have tried downloading the tarball and issuing the same command on the tar.gz and it doesnt match either.
curl -O http://address/0.0.9.tar.gz
shasum -a 256 0.0.9.tar.gz
What gives? I am sick of doing this dance. There has to be a less cumbersome way that only involves me committing my formula file once.
SOLVED
The problem was with the curl command.
The following command will output the correct sha256 checksum to put in the formula file.
Using Curl
curl -Ls https://address/0.0.9.tar.gz | shasum -a 256
Using wget
wget -qO- https://address/0.0.9.tar.gz | shasum -a 256