How do I specify a version number when installing something with brew cask install?
For recent versions of Homebrew, Jethro' instructions below may not work work, because we will get an error like:
Invalid usage: Non-checksummed download of <FORMULA_NAME> formula file from an arbitrary URL is unsupported.
I found a workaround:
Go to the Homebrew Cask search page: https://formulae.brew.sh/cask/
Type and find the application you are looking for
Click Cask code link
On Github click History button
Find the version you need by reading the commit messages and view the raw file. Confirm the version variable (normally on line 2) is the version you need.
Click on the name of the commit, then three dots and select View file
Right-click Raw button and Save Link As... to download the file locally
When downloaded, go to download directory cd Downloads/
Finally run brew install --cask <FORMULA_NAME>.rb
Voilà 😄
If you need some visual assistance check the screenshots here.
You can manually point brew at the ruby file for a specific version of a cask, using a git hash. This lets you control which version is installed.
For example:
Find the cask .rb file on the homebrew-cask git repo that you
want.
Get the commit hash, eg
cee7983cd95fc92fdc250fc509f2379cefe647fe in the example above.
Git may give you instructions to view the file history locally - eg git clone https://github.com/Homebrew/homebrew-cask.git git log master -- Casks/CASK_NAME.rb
Point brew at the file using the hash: brew cask install https://raw.githubusercontent.com/caskroom/homebrew-cask/cee7983cd95fc92fdc250fc509f2379cefe647fe/Casks/minikube.rb
The other answers are pretty heavy handed, an alternative is to use the homebrew/cask-versions tap which contains a list of the old (major) versions of casks.
To use them tap it with brew tap homebrew/cask-versions and then you can search for your cask again like brew search --cask yourformula and see if what you're looking for is there.
Or you can see the complete list of casks by clicking on Casks folder at https://github.com/Homebrew/homebrew-cask-versions .
If you run
brew edit [formula]
you can change the version that matches your operating system. If you know the checksum, enter that too. If not, just comment that line out with # and it will skip the check. Then run
HOMEBREW_NO_INSTALL_FROM_API=1 brew reinstall [formula]
Related
I have installed FFTW3 using HomeBrew which downloads the file located at https://homebrew.bintray.com/bottles/fftw-3.3.8_1.mojave.bottle.tar.gz and installs it on my system which is running on macOS 10.14.6. Now, the installation is fine and gcc is able to compile code that uses the fttw3.h header file.
However, there is supposed to be a ./configure script which I should be able to use to customise my configuration and, unfortunately, it does not exist in /usr/local/Cellar/fftw/3.3.8_1.
Where can I find it? How else should I configure the installation?
The build process of a Homebrew package is defined in a file called formula, which is written in Ruby.
A formula is a package definition written in Ruby. It can be created with brew create <URL> where is a zip or tarball, installed with brew install <formula>.
You can get the formula for fftw from homebrew/core/Formula/fftw.rb.
And the configuration options are defined in the args array.
# https://github.com/Homebrew/homebrew-core/blob/e7c8239a8a7c9b4501c4a18a4028cae82e254984/Formula/fftw.rb#L21-L30
def install
args = [
"--enable-shared",
"--disable-debug",
"--prefix=#{prefix}",
"--enable-threads",
"--disable-dependency-tracking",
"--enable-mpi",
"--enable-openmp",
]
Download the fftw.rb formula file and change the configuration options. After that, install the modified formula by building it from source.
brew install --build-from-source local/path/to/modified-fftw.rb
Extended Reading
To get how to write your own formula. Check
Formula Cookbook
How to Create and Maintain a Tap
FAQ
Why brew edit fftw is not recommended?
Homebrew is made of two parts: the brew command and formula repos. fftw.rb is a formula defined in the built-in, local formula repo homebrew-core. When you use brew edit fftw, you are editing the file from the local repo directly. Unless you're going to contribute to this repo, don't edit files within the homebrew-core repo directly.
I need to use the LFTP program for a script I run. I tried installing it from the website using the instructions in the downloaded folder's "INSTALL" file, but running config always failed. So, I tried to have Homebrew install it, and that worked great.
I have no idea where Homebrew fetches its source from, but the latest version it pulled has a bug which the developer has since fixed on GitHub. Is there a way I can get Homebrew to install the source from the latest commit?
Some packages, such as numpy have a --HEAD option.
--HEAD
Install HEAD version
but the lftp package doesn't have this option. One solution could be to implement it yourserlf:
brew edit lftp
P.S. the homebrew version of lftp already include a patch:
https://raw.githubusercontent.com/macports/macports-ports/edf0ee1e2cf/devel/m4/files/secure_snprintf.patch
it's maybe the same you are looking for. You can see how it's apply whit brew edit lftp.
I am trying to fix this error:
Error: swiftlint does not have a version "0.11.1" in the Cellar.
by running this:
brew install swiftlint-0.11.1
however this doesn't work, then I tried "brew search swiftlint", but nothing showed up.
Can anyone point to me the correct way to install swiftlint with a specific version?
Go to /usr/local/Cellar/swiftlint you will see all installed switflint version.
Copy swiftlint version folder from other Mac then paste into /usr/local/Cellar/swiftlint
You could check all versions in your Mac by brew info swiftlint
Switch to version you need by brew switch swiftlint x.xx.x
I uploaded some version ==> here
Update: Now you could use pods for this.
My project is using swift2.2 with SwiftLint 0.12.0 installed via brew.
And I decided to change to Pod. There are many changes and errors in each versions. My project is too big, and it's take time to fix all the error and warning (it may effect to current features also...).
Finally I choose pod 'SwiftLint', '0.16.0' and. disable_rules then I don't need to fix any warning nor error.
type_name
shorthand_operator
unused_closure_parameter
This involves a lot of steps, but anyway:
Find the Brew Formula for Swiftlint. It's here.
Now you'll need an older commit of Swift Lint, so you would normally click on the History tab and get to an older commit. However, GitHub might tell you that you need to clone the repo (git#github.com:Homebrew/homebrew-core.git) and then use git log master -- Formula/swiftlint.rb to find your older commit. I'll spare you the details of that.
Now you need a raw URL for an older commit. So the raw URL for the latest commit is https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/swiftlint.rb, but you would use https://github.com/Homebrew/homebrew-core/blob/COMMIT/Formula/swiftlint.rb
Now you can do a brew install directly using this older Swift Lint. In my case, I needed 0.15, so I used:
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/864095ea97b6d7dc88c772c7f9f36521cf81a77e/Formula/swiftlint.rb
Just go to Swiftlint release page and select the appropriate version.
Download it and extract it.
You should be able to see an executable and a licence txt file.
Now go to /usr/local/Cellar/swiftlint and create a folder with the version (for ex. 0.35.0).
Create a bin folder inside it and paste the swiftlint executable that you have downloaded.
Brew now shows the custom version that you have downloaded . You can check by typing brew info swiftlint in cmd
you can switch by brew switch swiftlint version_number
With mint, which I personally prefer, you can do:
mint install realm/SwiftLint#0.46.2
Go to the SwiftLint's releases section and find the version you're looking for.
Then download its installer (.pkg, .zip, etc), and run it.
Is there a way to to recompile from an edited source code via homebrew?
I did a change on the source user.hpp of Boost which I now want to recompile Boost with. I tried --build-from-source and --enable-bar but neither works, saying that it is already installed. The only way I can recompile is by reinstall but that simply overwrites the source code I changed.
Any idea?
First option
Download the archive, edit the files, and zip the archive as homebrew does (same name and format).
If you kept the original folder structure created by Homebrew, you can put the modified archive in ~/Library/Caches/Homebrew and then try brew install -f. (the -f is maybe not strictly necessary but it may be need for the SHA-1 mismatch.)
More info on this blog.
Second option
Pulled out from the Homebrew wiki, install the package without homebrew and then link it with brew.
./configure --prefix=/usr/local/Cellar/foo/1.2 && make && make install && brew link foo
Another approach is to add a patch to the homebrew formula (you can edit the formula using brew edit <formula-name>):
https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md#patches
I installed PIL and then I installed libjpeg and I get the following errors:
jpeg8-d is already installed, it's just not linked
Could not symlink file: /usr/local/Cellar/jpeg/8d/bin/wrjpgcom
Target /usr/local/bin/wrjpgcom already exists. You may need to delete it.
To force the link and delete this file, do:
brew link --overwrite formula_name
Both the problem and the solution are completely described by the error message you posted. What part of it do you not understand?
Could not symlink file: /usr/local/Cellar/jpeg/8d/bin/wrjpgcom
Target /usr/local/bin/wrjpgcom already exists.
This is telling you that, for some reason, you've got already got a /usr/local/bin/wrjpgcom from somewhere besides Homebrew, and Homebrew doesn't want to mess with it, in case you had a good reason for it.
To force the link and delete this file, do:
brew link --overwrite formula_name
If you have no idea where that file came from, don't care, and just want it to be blasted, just do brew link --overwrite jpeg8-d.
You probably also want to run brew doctor to have it look for other problems in your setup that you should fix.