Homebrew / homebrew-cask

🍻 A CLI workflow for the administration of macOS applications distributed as binaries
https://brew.sh
BSD 2-Clause "Simplified" License
20.84k stars 10.67k forks source link

OS X Yosemite: after installing brew-cask, brew doesn't recognize it as a command #4685

Closed kreeger closed 9 years ago

kreeger commented 10 years ago

Image

@tcarlsen and I have been seeing this issue on Yosemite. The homebrew team patched things up throughout the day on Tuesday and now brew itself appears to work okay; I was able to install tons and tons of recipes on a fresh install of Yosemite through home-brew.

brew-cask on the other hand doesn't seem to get noticed by brew after it's tapped on a fresh install of Yosemite. See screenshot above.

It'd be great to get brew-cask working again. I miss it already! (I don't know enough about homebrew's inner workings yet, otherwise I'd submit a PR. :beers: to who does, though!)

This issue was spun off of issue #4667.

tcarlsen commented 10 years ago

I did a update of Yosemite, not a fresh install

rolandwalker commented 10 years ago

Homebrew finds external commands such as brew-cask.rb by virtue of their being on the $PATH and by having their executable bit set. The part about the executable bit is a little strange, because the file gets required by Ruby, not executed, but that's how Homebrew does it. (Or maybe did it until today, as something is not working for you.)

If you have installed to the default locations, Homebrew should have created a symlink at

/usr/local/bin/brew-cask.rb

which refers to an executable file at (currently)

/usr/local/Cellar/brew-cask/0.35.0/bin/brew-cask.rb

So, for the command brew cask to work, things should look something like this:

$ printenv PATH
/usr/bin:/usr/local/bin:.....
$ ls -la /usr/local/bin/brew-cask.rb
lrwxr-xr-x 1 user staff 43 May  9 10:25 /usr/local/bin/brew-cask.rb -> ../Cellar/brew-cask/0.35.0/bin/brew-cask.rb
$ ls -la /usr/local/Cellar/brew-cask/0.35.0/bin/brew-cask.rb
-rwxr-xr-x 1 user staff 203 May  9 10:25 /usr/local/Cellar/brew-cask/0.35.0/bin/brew-cask.rb

(Note that, confusingly, there are two different brew-cask.rb files. The one at /usr/local/Library/Formula/brew-cask.rb is the Formula used for installing this project, the one given above is the external command invoked by brew cask.)

tcarlsen commented 10 years ago

@rolandwalker hers mine:

$ printenv PATH
/Users/tcarlsen/.nvm/v0.10.26/bin:./bin:/usr/local/bin:/usr/local/sbin:/Users/tcarlsen/.dotfiles/bin:/Users/tcarlsen/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
$ ls -la /usr/local/bin/brew-cask.rb
lrwxr-xr-x 1 tcarlsen admin 43 Jun  4 20:37 /usr/local/bin/brew-cask.rb -> ../Cellar/brew-cask/0.35.0/bin/brew-cask.rb*
$ ls -la /usr/local/Cellar/brew-cask/0.35.0/bin/brew-cask.rb
-rwxr-xr-x 1 tcarlsen staff 203 Jun  4 20:37 /usr/local/Cellar/brew-cask/0.35.0/bin/brew-cask.rb*

and /usr/local/bin/brew-cask.rb do ref to /usr/local/Cellar/brew-cask/0.35.0/bin/brew-cask.rb

rolandwalker commented 10 years ago

Those files look kosher, but your $PATH might be trouble. rbenv shims could certainly affect matters. I would try radically simplifying $PATH:

$ PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin brew cask

as well as checking the output of brew doctor.

It seems that Homebrew switched to Ruby 2.0 to make things work on Yosemite. That's a fairly major jump from 1.8. (I'm surprised the breakage is not greater.)

caarlos0 commented 10 years ago

Same issue here:

2.1.1 in carlos/
› PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin brew cask
Error: Unknown command: cask

2.1.1 in carlos/
› brew doctor
Error: No such file or directory - /Library/Developer/CommandLineTools/usr/bin/clang
amdprophet commented 10 years ago

I made a symlink from /Library/Developer/CommandLineTools/usr/bin/clang to /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang /Library/Developer/CommandLineTools/usr/bin/clang and brew doctor is working now.

Nothing out of the ordinary in the brew doctor output.

kreeger commented 10 years ago

I figured out that iTerm2 is the culprit; it's not picking up $PATH properly in certain environments. I'm seeing it all over the place, even with stock homebrew now (and with direnv).

Running it in Terminal.app performs just fine.

Related issue here: homebrew/homebrew#29843

caarlos0 commented 10 years ago

@kreeger indeed... and this is really weird.

nanoxd commented 10 years ago

@kreeger If you use tmux in iTerm2 the problem goes away.

kreeger commented 10 years ago

A bug report has been filed on iTerm2 (whether or not it's a bug with iTerm2) right here. If there indeed is an issue with OS X 10.10 and not iTerm2, then it's probably a good idea for us to use this fix and let iTerm2 weather out the ever-changing-and-fixing-Developer-Preview storm.

tcarlsen commented 10 years ago

@kreeger that did it for me!!!

For those who come later, using iTerm2:

  • Go to Profiles > Open Profiles...
  • Select your profile, Default if you only have one, then click the Edit Profiles... button
  • Change the Command radio button from Login shell to Command and paste in /bin/bash -c /bin/zsh. See screenshot:
rolandwalker commented 10 years ago

My understanding is that this bug does not touch on any code in Homebrew-cask, and there's nothing we can fix.

However, it would be nice to leave the issue open for a little while to help other people find these solutions.

rolandwalker commented 10 years ago

The cross-reference with #4869 (zap stanza) is just a typo, since corrected there.

dzegna commented 9 years ago

@kreeger @tcarlsen Thanks guys! I just updated to Yosemite today and happened to stumble onto cask as I was doing my development setup. I'm using iTerm2 and couldn't figure out what I was doing wrong trying to get cask to work.

tcarlsen commented 9 years ago

Hope you got it running @dzegna?