Homebrew cask Calling `brew cask` with the `--caskroom` flag is disabled - homebrew

When I type $ brew cask in iterm2. I have tired only use brew can work, but use cask then return this error.
then
Error: Calling `brew cask` with the `--caskroom` flag is disabled!
There is no replacement.
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/options.rb:53:in `block (3 levels) in process_arguments'
I use MacBook Pro 13.
homebrew config
HOMEBREW_VERSION: 1.3.6
ORIGIN: https://github.com/Homebrew/brew
HEAD: 270b752f5d9d218bfbed6fe85b6974fa653fb25f
Last commit: 2 weeks ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 97f00b13e1bc310cfdf7b419a1844632781b88b9
Core tap last commit: 28 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit haswell
Homebrew Ruby: 2.3.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 9.0 build 900
Git: 2.13.5 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Java: 1.8.0_111
macOS: 10.13-x86_64
Xcode: 9.0.1
CLT: N/A
X11: N/A

Did you set HOMEBREW_CASK_OPTS environment variable?
If so, all you need is to remove the --caskroom flag from it.

Related

Switching elm version with homebrew - permissions issue

I am trying to switch versions of elm, as installed by homebrew.
elm --version
0.18.0
brew switch elm 0.16.0
Cleaning /usr/local/Cellar/elm/0.16.0
Cleaning /usr/local/Cellar/elm/0.18.0
7 links created for /usr/local/Cellar/elm/0.16.0/
brew prune
brew link elm
elm --version
-bash: /usr/local/bin/elm: Permission denied
File permissions of the folders containing 0.16.0 and 0.17.0:
drwxr-xr-x# 5 my.name admin 170B 10 Feb 09:53 0.16.0/
drwxr-xr-x 7 my.name admin 238B 10 Feb 09:52 0.18.0/
If I switch back to 0.18.0, everything works correctly:
brew switch elm 0.18.0
Cleaning /usr/local/Cellar/elm/0.16.0
Cleaning /usr/local/Cellar/elm/0.18.0
6 links created for /usr/local/Cellar/elm/0.18.0
brew prune
brew link elm
Warning: Already linked: /usr/local/Cellar/elm/0.18.0
To relink: brew unlink elm && brew link elm
elm --version
0.18.0
There is also a tool like nvm (node version manager) for switching elm versions. Here https://github.com/rtfeldman/elm-use you can read more info about it.
You can easily install it with
npm install -g elm-use
Then you can do elm-use 0.17 or whatever version you want to use
It seems npm is best for installing elm.
brew uninstall elm
npm install elm#0.16.0
Done

Installing elixir with homebrew fails due to jpeg

I'm trying to install elixir and it fails installing one of its dependencies, jpeg:
$ brew install elixir
==> Installing dependencies for elixir: jpeg, libtiff, wxmac, erlang
Error: /usr/local/Library/LinkedKegs/jpeg is not a valid keg
So of course I try brew install jpeg and a few others:
$ brew install jpeg
Error: jpeg-jpeg already installed
To install this version, first `brew unlink jpeg'
$ brew unlink jpeg
Error: No such keg: /usr/local/Cellar/jpeg
$ brew info jpeg
jpeg: stable 8d (bottled)
JPEG image manipulation library
http://www.ijg.org
Not installed
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/jpeg.rb
==> Options
--universal
Build a universal binary
And if I run brew doctor, it just tells me to install jpeg. Has anyone run into this before? I'm on Yosemite 10.10.5. I didn't expect to see jpeg-jpeg already installed after trying to install jpeg.
My brew --config:
$ brew --config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew.git
HEAD: 070b76df5a4096dcc6196fc51e56185ae7dfd617
Last commit: 80 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit broadwell
OS X: 10.10.5-x86_64
Xcode: 7.1
CLT: 7.1.0.0.1.1444952191
Clang: 7.0 build 700
X11: N/A
System Ruby: 2.0.0-p481
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /Users/Me/.rbenv/shims/ruby => /Users/Me/.rbenv/versions/2.1.2/bin/ruby
Java: 1.8.0_51, 1.6.0_65-b14-468
Updated with brew remove --force jpeg:
$ brew remove --force jpeg
$ brew install jpeg
Error: jpeg-jpeg already installed
To install this version, first `brew unlink jpeg'
I ended up getting this to work by following guidance in https://github.com/Homebrew/homebrew/issues/37250. Specifically, this comment. Following that, I just removed the directory at /usr/local/Library/LinkedKegs/jpeg and was then able to install jpeg just fine.

Brew doctor shows warnings How to solve it

I am new to OSX while running
brew doctor
shows the following warnings.
Warning: You have an outdated version of /usr/bin/install_name_tool installed.
This will cause binary package installations to fail.
This can happen if you install osx-gcc-installer or RailsInstaller.
To restore it, you must reinstall OS X or restore the binary from
the OS packages.
Warning: Some keg-only formula are linked into the Cellar.
Linking a keg-only formula, such as gettext, into the cellar with
`brew link <formula>` will cause other formulae to detect them during
the `./configure` step. This may cause problems when compiling those
other formulae.
Binaries provided by keg-only formulae may override system binaries
with other strange results.
You may wish to `brew unlink` these brews:
openssl
Is there anyway to solve the error without reinstalling OS?
I need to install ruby rails, it shows some errors while running
rails server
command. I think the problem is due to the above warnings.
thanks in advance
#Yahya, I ran into the same problem and managed to fix it after reading this thread: https://github.com/Homebrew/homebrew/issues/29989
I've tried both suggested solutions (reinstalling the essentials package vs copying only the install_name_tool binary) and both worked equally fine (I've given examples for each of them below)
Therefore for Yosemite systems I recommend the fast 'clone&copy' approach, where as for the Mavericks ones - the much slower package replacement.
Yosemite OS
First check the current version of install_name_tool
$ otool -L /usr/bin/install_name_tool
/usr/bin/install_name_tool
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.3)
Now clone the Yosemite compatible binary from Github and replace the one in your /usr/bin folder:
$ git clone https://github.com/cinic/install-name-tool
Cloning into 'install-name-tool'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 3
Unpacking objects: 100% (3/3), done.
Checking connectivity... done.
$ sudo mv /usr/bin/install_name_tool /usr/bin/install_name_tool.orig
$ sudo cp install-name-tool/install_name_tool /usr/bin/
Finally check if the version is updated and if homebrew is fixed:
$ otool -L /usr/bin/install_name_tool
/usr/bin/install_name_tool:
/usr/lib/libxcselect.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
$ brew doctor
Your system is ready to brew.
Finally
$ rm -fr install-name-tool/
$ sudo rm /usr/bin/install_name_tool.orig
Mavericks
Download the Mavericks installer from App store
$ open /Applications/Install\ OS\ X\ Mavericks.app/Contents/SharedSupport/InstallESD.dmg
$ open /Volumes/OS\ X\ Install\ ESD/Packages/Essentials.pkg
After the package is installed, check if the brew doctor output.
If you are using Homebrew, it will often look for items you have and link them. It looks like it's done that with openssl. You have three options:
Uninstall and reinstall openssl
brew uninstall openssl
brew install openssl
Try upgrading openssl
brew update openssl
Or you can try unlinking openssl (though, only do this if you know where you openssl is)
brew unlink openssl
I also faced the same issue and would get the warning that "/usr/bin/install_name_tool" was outdated.
The problem is that Xcode's install_name_tool has been updated, while the one in the system is outdated.
This can be solved by copying Xcode's install_name_tool to the system.
Use this command :
sudo cp /Applications/Xcode.app/Contents//Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool /usr/bin/install_name_tool
install_name_tool should now be updated.

How can I brew link a specific version?

I have a few kegs of the same package in /usr/local/Cellar/libfoo like /usr/local/Cellar/libfoo/1.0.1, /usr/local/Cellar/libfoo/HEAD and /usr/local/Cellar/libfoo/mycopy
How can I brew link to a specific version?
This is probably the best way as of 11.1.2022:
To install a specific version, e.g. postgresql 9.5 you simply run:
$ brew install postgresql#9.5
To list the available versions run a search with #:
$ brew search postgresql#
==> Formulae
postgresql postgresql#11 postgresql#13 postgresql#9.5 qt-postgresql
postgresql#10 postgresql#12 postgresql#9.4 postgresql#9.6 postgrest
==> Casks
navicat-for-postgresql
DEPRECATED in Homebrew 2.6.0 (December 2020):
The usage info:
Usage: brew switch <formula> <version>
Example:
brew switch mysql 5.5.29
You can find the versions installed on your system with info.
brew info mysql
And to see the available versions to install, you can provide a dud version number, as brew will helpfully respond with the available version numbers:
brew switch mysql 0
Update (15.10.2014):
The brew versions command has been removed from brew, but, if you do wish to use this command first run brew tap homebrew/boneyard.
The recommended way to install an old version is to install from the homebrew/versions repo as follows:
$ brew tap homebrew/versions
$ brew install mysql55
For detailed info on all the ways to install an older version of a formula read this answer.
Sadly brew switch is deprecated in Homebrew 2.6.0 (December 2020)
$ brew switch
Error: Unknown command: switch
TLDR, to switch to package version 10:
brew unlink package
brew link package#10
To use another version of a package, for example node:
First, ensure that the specific version is installed using brew list. My package here is node (16) and node#14.
➜ ~ brew list
==> Formulae
node
node#14
➜ ~ node -v
v16.1.0
Unlink the current package: brew unlink node.
➜ ~ brew unlink node
Unlinking /usr/local/Cellar/node/16.1.0... 7 symlinks removed.
Link the correct version
➜ ~ brew link node#14
Linking /usr/local/Cellar/node#14/14.16.1_1... 3857 symlinks created.
If you need to have this software first in your PATH instead consider running:
echo 'export PATH="/usr/local/opt/node#14/bin:$PATH"' >> ~/.zshrc
➜ ~ node -v
v14.16.1
Homebrew removed brew switch subcommand in Homebrew 2.6.0. Get it back from here.
brew tap laggardkernel/tap
brew switch --help
name#version formula
There's mainly two ways to switch to an old version of an app.
If it's a bigger version change. Homebrew may have created a versioned package in the repo. Like go, go#1.10, they are two different formulae, installed into two different locations.
# install the old one
brew install go#1.10
# link the executable into /usr/local/bin, or /opt/homebrew/bin
brew link --overwrite --force go#1.10
brew switch
But not every package has a versioned variant. If you just upgraded to the new version and the old one is still in your system, skip step 1, 2.
In this situation, search in the homebrew-core repo and download the specific formula. e.g. mysql 8.0.23
Download the raw file, and install from it brew install /path/to/downloaded/mysql.rb.
Now both the latest and the old 8.0.23 (same formula mysql) exist, switch (link out) the old version with brew switch mysql 8.0.23
brew info mysql will list all the old version still exist.
Step 1, 2 could be replaced by brew extract, but that requires user maintain its own tap. I won't cover it here, just search it if you're interested.
If you have installed, for example, php 5.4 it could be switched in the following way to php 5.5:
$ php --version
PHP 5.4.32 (cli) (built: Aug 26 2014 15:14:01)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
$ brew unlink php54
$ brew switch php55 5.5.16
$ php --version
PHP 5.5.16 (cli) (built: Sep 9 2014 14:27:18)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
brew switch libfoo mycopy
You can use brew switch to switch between versions of the same package, if it's installed as versioned subdirectories under Cellar/<packagename>/
This will list versions installed ( for example I had Cellar/sdl2/2.0.3, I've compiled into Cellar/sdl2/2.0.4)
brew info sdl2
Then to switch between them
brew switch sdl2 2.0.4
brew info
Info now shows * next to the 2.0.4
To install under Cellar/<packagename>/<version> from source you can do for example
cd ~/somewhere/src/foo-2.0.4
./configure --prefix $(brew --Cellar)/foo/2.0.4
make
check where it gets installed with
make install -n
if all looks correct
make install
Then from cd $(brew --Cellar) do the switch between version.
I'm using brew version 0.9.5
In case brew switch produces an error (in this example trying to switch to node version 14):
> brew switch node 14
Error: Calling `brew switch` is disabled! Use `brew link` #-versioned formulae instead.
The correct way switching versions would be :
> brew link --overwrite node#14
if #simon's answer is not working in some of the mac's please follow the below process.
If you have already installed swiftgen using the following commands:
$ brew update
$ brew install swiftgen
then follow the steps below in order to run swiftgen with older version.
Step 1: brew uninstall swiftgen
Step 2: Navigate to: https://github.com/SwiftGen/SwiftGen/releases
and download the swiftgen with version: swiftgen-4.2.0.zip.
Unzip the package in any of the directories.
Step 3:
Execute the following in a terminal:
$ mkdir -p ~/dependencies/swiftgen
$ cp -R ~/<your_directory_name>/swiftgen-4.2.0/ ~/dependencies/swiftgen
$ cd /usr/local/bin
$ ln -s ~/dependencies/swiftgen/bin/swiftgen swiftgen
$ mkdir ~/Library/Application\ Support/SwiftGen
$ ln -s ~/dependencies/swiftgen/templates/ ~/Library/Application\ Support/SwiftGen/
$ swiftgen --version
You should get: SwiftGen v0.0 (Stencil v0.8.0, StencilSwiftKit v1.0.0, SwiftGenKit v1.0.1)

Homebrew keeps telling me to update but it does not let me update

$ brew doctor
Warning: Your Homebrew is outdated
You haven't updated for at least 24 hours, this is a long time in brewland!
Then:
$ brew update
$ brew --config
HOMEBREW_VERSION: 0.9
HEAD: (none)
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit sandybridge
OS X: 10.7.3
Kernel Architecture: x86_64
Xcode: 4.3.2
GCC-4.0: N/A
GCC-4.2: build 5666
LLVM: build 2335
Clang: 2.1 build 163
MacPorts or Fink? false
X11: /usr/X11
System Ruby: 1.8.7-249
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Which Perl: /usr/bin/perl
Which Python: /usr/local/bin/python => /System/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python
Which Ruby: /Users/luis/.rvm/rubies/ruby-1.9.2-p318/bin/ruby
This happend in my other mac and I when I brew upgrade brew outdated nothing happened.
I am afraid this will do the same even dough is a new installation.
how can I fix this?
Instead of using brew upgrade did you tried using brew update. It solved the problem for me.
There are differences between brew update and brew upgrade
brew update
Updates your local database of available (and no longer available) installable packages otherwise know in brew terminology as Formulae.
brew upgrade
Updates all the installed packages on your system currently. E.g. Upgrading PHP 5.3.20 to 5.3.21.
I don't see an error after you try to update, if you update and then run brew doctor again and it doesn't show the out of date error anymore then you are fully up to date.

Resources