Total Pageviews

Wednesday, 9 March 2016

Mac安装软件的新方法-cask

假设你已安装好了Homebrew,安装与使用cask极其简单,打开终端,输入:
安装cask的命令:
brew tap caskroom/cask
(or:
brew tap phinze/homebrew-cask
brew install brew-cask)

然后用下述命令即可安装skype:
brew cask install skype


brew cask install evernote
brew cask install mou
brew cask install qq
brew cask install virtualbox
brew cask install vagrant

系统工具

brew cask install alfred

from https://caskroom.github.io
https://github.com/caskroom/homebrew-cask
----------------------------------------------------------
常用命令 
  • brew cask search 列出所有可以被安装的软件
  • brew cask search drop 查找所有和 drop 相关的app
  • brew cask info thunder 查看 迅雷 应用的信息,这货安装的可是最新版本的迅雷哦!
  • brew cask uninstall qq 卸载 QQ
  • brew cask list ( 查看用cask安装的程序)
特别注意 homebrew-cask是将应用程序放置在/opt/homebrew-cask/Caskroom/下,会在你的家目录中的「应用程序」文件夹中创建一个类似快捷方式的替身。在Finder的偏好设置中,第三个侧边栏勾选上你的家目录,这样找应用会方便一些。但不用太担心你,Launchpad是会找到这个目录下的应用的,需要Alfred支持请查看brew cask alfred

更新軟體

可以執行下列來更新 cask 的軟體列表。



1
brew cask update 或 brew update

可以看更多的使用及設定說明

設定

而 caskroom 預設會把軟體裝在系統的 /opt/homebrew-cask/Caskroom/ 資料夾下,然後會在使用者的 ~/Applications/ 目錄下建立一個軟體的替身。
如果想改變安裝軟體捷徑放的位置,有 2 種方法:
一個是每次安裝時帶入 --appdir=/path 或是不想每次安裝都輸入,可以在.bash_profile 或 .zshenv 設定一個永久的:



1
export HOMEBREW_CASK_OPTS="--appdir=/Applications --caskroom=/etc/Caskroom"

更多的設定說明
還有當然若不想要每次都打 brew cask 有點麻煩,你還可以加入 alias cask="brew cask",這樣只要打 cask 就好了。

更多 Casks

除了軟體之外,還可以安裝字型及 QuickLook 外掛,像是在 QuickLook 看 josn、js、Markdown 等等的。
要裝 QuickLook 的外掛直接打指令就好 像是:



1
brew cask install qlcolorcode qlstephen qlmarkdown

https://github.com/sindresorhus/quick-look-plugins 這收錄 QuickLook 有那些外掛。
字體的話還需要先執行 brew tap caskroom/fonts 下載字體的安裝列表,之後就跟安裝軟體一樣 brew cask install font-source-code-pro 安裝你要的字體名就可以了。

整合 Alfred

由於 cask 預設會裝在系統的 /opt/… 目錄下,為了讓 Alfred 可以搜尋到已裝的軟體,你必需把軟體安裝的目錄加入 Alfred 的 Search Scope , 可輸入 brew cask alfred link 就幫你加好了!! 真大心啊~
然後還要再推的就是 Cask for Alfred , 讓你直接在 Alfred 裡就可以安裝,很方便,只是有點可惜,它似乎不會抓我自訂設定的安裝目錄 --appdir 等等的環境參數。
最後分享一下我裝的 List

homebrew-cask vs Mac App Store

homebrew-cask 和 Mac App Store 相比,目前还有很多优势:
  1. 安装软件体验非常一致简洁优雅 
  2. 对常用软件支持更全面,例如 MPlayerX 已经宣布不在更新 Mac App Store上 的版本 
  3. 软件更新速度快,体验好。例如Alfred 2.0已经出了很久,但在 Mac App Store 上还是1.2版本,QQ也是这样的情况
当然我承认,命令行的交互方式并不是人人都能学会和接受,homebrew-cask其实已经做的足够简单易用,习得这一技能能在以后提高效率。homebrew-cask安装省时省力,更新应用也简单,不用一个一个去找,其实先花时间学习,是值回本钱的,大家自己算算这笔帐。
Mac App Store 生态圈远不完善,审核流程过长,限制太多,维护成本过高让很多应用开发者被迫离开。虽然我个人很喜欢 homebrew-cask,但还是希望 Apple 尽快完善 Mac App Store ,等到有一天我可以不再使用 homebrew-cask。这样说是不是显得我很薄情?:) 

关于软件更新

homebrew-cask团队一直还在探讨软件更新策略,以及homebrew-cask与homebrew的关系。目前倾向于:
  1. homebrew-cask作为软件安装工具,体验是不错的(相比你要自己到网页上搜索,下载,拖转安装) 
  2. 大部分软件都有自更新的功能,体验也不错,绝大多数只需要一次点击就能更新 
  3. 实际上软件更新没有那么频繁,使用brew cask uninstall qq && brew cask install qq 也比上网自己下载更新方便
软件更新的结论
目前通过homebrew-cask安装的软件有两种更新方法:
  1. 使用软件自己的更新流程 .
  2. brew cask uninstall APP && brew cask install APP 先删除App,再重新安装.
详细情况可以围观这个讨论帖子: brew cask upgrade, 具体看 第2条 和 第5条 评论。
一键装机?有了homebrew-cask就可以.
# 到目前October 5, 2013 1:43 PM为止,homebrew-cask共收录566款应用程序
# 瞬间安装所有常用软件

brew cask install alfred
brew cask install the-unarchiver
brew cask install qq
brew cask install line
brew cask install skype
brew cask install thunder
brew cask install mplayerx
brew cask install evernote
brew cask install skitch
brew cask install dropbox
brew cask install google-chrome
brew cask install mou
brew cask install iterm2
brew cask install sublime-text
brew cask install virtualbox

------------------------

创建你的cask

homebrew-cask一发布,即得到广泛支持,请参考homebrew cask 已支持软件列表。不过有些特殊软件,它并不支持。如何创建自己的cask?并共享给其它用户?
请参考homebrew-cask官方文档:How to Contribute
-----------------------------
https://aaaaaashu.gitbooks.io/mac-dev-setup/content/Homebrew/Cask.html
http://sourabhbajaj.com/mac-setup/Homebrew/Cask.html
http://gillesfabio.github.io/homebrew-cask-homepage/
---------------------------

Homebrew-Cask

A CLI workflow for the administration of Mac applications distributed as binaries 

“To install, drag this icon…” no more!
Homebrew-Cask extends Homebrew and brings its elegance, simplicity, and speed to the installation and management of GUI macOS applications such as Google Chrome and Adium.
We do this by providing a friendly Homebrew-style CLI workflow for the administration of macOS applications distributed as binaries.
It’s implemented as a homebrew external command called cask.
Build Status Join the chat at https://gitter.im/caskroom/homebrew-cask

Let’s try it!

To start using Homebrew-Cask, you just need Homebrew installed.
Installing Atom (animated gif)
Slower, now:
$ brew cask install atom
==> Satisfying dependencies
complete
==> Downloading https://github.com/atom/atom/releases/download/v1.8.0/atom-mac.zip
######################################################################## 100.0%
==> Verifying checksum for Cask atom
==> Moving App 'Atom.app' to '/Applications/Atom.app'
==> Symlinking Binary 'apm' to '/usr/local/bin/apm'
==> Symlinking Binary 'atom.sh' to '/usr/local/bin/atom'
🍺  atom was successfully installed!
And there we have it. Atom installed with one quick command: no clicking, no dragging, no dropping.

Learn More

  • Find basic documentation on using Homebrew-Cask in USAGE.md
  • Want to contribute a Cask? Awesome! See CONTRIBUTING.md
  • Want to hack on our code? Also awesome! See hacking.md
  • More project-related details and discussion are available in the documentation

Reporting bugs

Like most pieces of software, Homebrew-Cask has bugs — and we are busy fixing them! If you find a new bug tell us about it, but before you do make sure the problem isn’t simply an outdated setup on your side, by following this guide.
If your issue persists, follow these instructions to the appropriate course of action:

Requests

Questions? Wanna chat?

We’re really rather friendly! Here are the best places to talk about the project:
  • If none of the templates above is appropriate, open an issue.
  • Join us (and caskbot) on IRC at #homebrew-cask on Freenode
  • Join us on Gitter.
from https://github.com/caskroom/homebrew-cask
-------------


homebrew-unofficial

Casks of unofficial, vendorless, or walled builds for homebrew-cask
This repository contains Caskfiles for apps that have user-contributed (unofficial) app bundles (no official app bundle download source exists), Caskfiles without an official vendor (e.g. forum posts), and Caskfiles whose download binary is both behind a registration wall and served from an unofficial host (and thus difficult or impossible for maintainers to corroborate). For apps with verified, official download sources, see the main homebrew-cask project.
IMPORTANT: By using the Caskfiles in this repository, you are tapping into untrusted software! While we try our best to audit Caskfiles and ensure their operation, we cannot offer any guarantee on the software provided.

Usage

After you have installed homebrew-cask, add this tap to the list of your homebrew tap sources:
brew tap alehouse/homebrew-unofficial
You now have access to install casks from here just as you would from the official project:

brew cask install bug hub
from https://github.com/alehouse/homebrew-unofficial