0

这是错误:

$ brew cask install sublime-text
错误:没有这样的文件或目录 -brew-cask

4

1 回答 1

1

brew cask install当天早些时候正在工作,所以我希望这只是加载路径的更改影响了 shell 查找和运行brew cask install命令的能力。

因此,我进行了详尽的搜索:

$ find / \( -name "brew\-cask*" -type f \) -or \( -ilname "*brew-cask*" \) 2>/dev/null | grep brew-cask | xargs ls -l

-rw-r--r--  1 lex  admin    0 Sep  1 16:42 /Library/Caches/Homebrew/Formula/brew-cask.brewing
-rwxr-xr-x  1 lex  admin  193 Aug 31 20:35 /Library/Caches/Homebrew/brew-cask--git/bin/brew-cask.rb
-rw-r--r--  1 lex  admin  470 Aug 31 20:35 /Library/Caches/Homebrew/brew-cask--git/brew-cask.rb
-rwxr-xr-x  1 lex  wheel  197 Sep  1 16:39 /usr/local/Cellar/brew-cask/0.15.0/bin/brew-cask.rb
lrwxr-xr-x  1 lex  admin   32 Aug 31 20:35 /usr/local/Library/Formula/brew-cask.rb -> ../Taps/phinze-cask/brew-cask.rb
lrwxr-xr-x  1 lex  admin   29 Sep  1 16:39 /usr/local/Library/LinkedKegs/brew-cask -> ../../Cellar/brew-cask/0.15.0
-rwxr-xr-x  1 lex  admin  193 Aug 31 20:35 /usr/local/Library/Taps/phinze-cask/bin/brew-cask.rb
-rw-r--r--  1 lex  admin  470 Aug 31 20:35 /usr/local/Library/Taps/phinze-cask/brew-cask.rb
lrwxr-xr-x  1 lex  admin   43 Sep  1 16:39 /usr/local/bin/brew-cask.rb -> ../Cellar/brew-cask/0.15.0/bin/brew-cask.rb
lrwxr-xr-x  1 lex  admin   26 Sep  1 16:39 /usr/local/opt/brew-cask -> ../Cellar/brew-cask/0.15.0

最后两行看起来很有趣......

$ ls -l /usr/local/Cellar/brew-cask/0.15.0/bin/brew-cask.rb
-rwxr-xr-x  1 lex  wheel  197 Sep  1 16:39 /usr/local/Cellar/brew-cask/0.15.0/bin/brew-cask.rb

$ ls -l /usr/local/Cellar/brew-cask/0.15.0
total 16
drwxr-xr-x  421 lex  wheel  14314 Sep  1 16:39 Casks
-rw-r--r--    1 lex  admin    226 Sep  1 16:39 INSTALL_RECEIPT.json
-rw-r--r--    1 lex  wheel   1909 Sep  1 16:39 README.md
drwxr-xr-x    3 lex  wheel    102 Sep  1 16:39 bin
drwxr-xr-x    5 lex  wheel    170 Sep  1 16:39 rubylib

嗯.../usr/local/opt/brew-cask指向一个包含 bin 目录的目录,然后包含 brew-cask...

然后,我查看了我的加载路径......

$ echo $PATH
/Users/lex/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/coreutils/libexec/gnubin:/Users/lex/.rbenv/bin:/Users/lex/.rbenv/shims:/Users/lex/bin:/usr/local/opt:/usr/local/bin:/usr/bin

果然,我的 PATH 已更改为在/usr/local/opt将文件加载到 /usr/local/bin 之前加载文件。

目录中的其余“可执行文件”类似 /usr/local/opt。所以,我把它从我的路径中删除了。

我又试了...

$ brew cask install sublime-text
==> Downloading http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.2.dmg
######################################################################## 100.0%
==> Success! sublime-text installed to /opt/homebrew-cask/Caskroom/sublime-text/2.0.2
==> Linking Sublime Text 2.app to /Users/lex/Applications/Sublime Text 2.app

成功 :-)

于 2013-09-01T23:36:56.460 回答