brew如何安装指定版本软件

in cs •  7 years ago  (edited)

本文以qt为例

查看brew安装版本信息

Chaim:python Chaim$ brew info qt5
qt: stable 5.10.1 (bottled), HEAD [keg-only]
Cross-platform application and UI framework
https://www.qt.io/
/usr/local/Cellar/qt/5.10.1 (9,375 files, 295.1MB)
  Poured from bottle on 2018-02-28 at 16:45:54
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/qt.rb
==> Dependencies
Build: pkg-config 鉁�
Optional: mysql 鉁�, postgresql 鉁�
==> Requirements
Build: xcode 鉁�
Required: macOS >= 10.8 鉁�
==> Options
--with-docs
    Build documentation
--with-examples
    Build examples
--with-mysql
    Build with mysql support
--with-postgresql
    Build with postgresql support
--without-proprietary-codecs
    Don't build with proprietary codecs (e.g. mp3)
--HEAD
    Install HEAD version
==> Caveats
We agreed to the Qt opensource license for you.
If this is unacceptable you should uninstall.

This formula is keg-only, which means it was not symlinked into /usr/local,
because Qt 5 has CMake issues when linked.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/qt/lib
    CPPFLAGS: -I/usr/local/opt/qt/include
For pkg-config to find this software you may need to set:
    PKG_CONFIG_PATH: /usr/local/opt/qt/lib/pkgconfig

安装旧版本qt

找到From源,直接用sourcetree从 https://github.com/Homebrew/homebrew-core.git 克隆代码库,或者用命令行,详细见参考链接

Chaim:workspace Chaim$ cd homebrew-core/

Chaim:homebrew-core Chaim$ git log ./Formula/qt.rb | less

找到5.10.0版本信息,切换到5.10.0版本
Chaim:homebrew-core Chaim$ git checkout 2b39f1c75184858d36e9933dfe695c5023286e05
Note: checking out '2b39f1c75184858d36e9933dfe695c5023286e05'.
HEAD is now at 2b39f1c751... qt 5.10.0

查看信息是否正确
Chaim:homebrew-core Chaim$ cat ./Formula/qt.rb
  url "https://download.qt.io/official_releases/qt/5.10/5.10.0/single/qt-everywhere-src-5.10.0.tar.xz"
  mirror "https://www.mirrorservice.org/sites/download.qt-project.org/official_releases/qt/5.10/5.10.0/single/qt-everywhere-opensource-src-5.10.0.tar.xz"

Chaim:homebrew-core Chaim$ brew uninstall --ignore-dependencies qt5
Uninstalling /usr/local/Cellar/qt/5.10.1... (9,375 files, 295.1MB)

Chaim:homebrew-core Chaim$ brew install ./Formula/qt.rb

参考

https://www.jianshu.com/p/aadb54eac0a8

***************************************

作者简介


老鱼,从事互联网技术十余年,知名上市公司CTO;炒股十余年,从亏损几十万到略有盈利;顺应创业大潮多次创业,在传统行业和手游行业有所获;研习佛学易理,性格淡泊清净!

欢迎有兴趣的朋友加入微信群和电报群,一起学习探讨,一起实现咱们的小目标!

  • 百分百区块链群,微信扫码后会再显示一个二维码,长按图片“识别图中二维码”加入!


Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Upvoted ☝ Have a great day!

You too!