V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
fffang
V2EX  ›  iDev

brew3.0+如何安装指定版本软件?

  •  
  •   fffang · 2021-05-25 14:43:07 +08:00 · 3179 次点击
    这是一个创建于 1039 天前的主题,其中的信息可能已经有所发展或是发生改变。

    之前 brew2.0+的时候可以通过扒指定版本的 name.rb 文件,通过 rb 文件安装,升级 brew3.0+后无法使用这种方式了。brew install name@version也不行。

    7 条回复    2021-05-26 20:21:19 +08:00
    shyling
        1
    shyling  
       2021-05-25 15:02:34 +08:00   ❤️ 1
    brew install -s ./node.rb
    IgniteWhite
        2
    IgniteWhite  
       2021-05-25 16:24:32 +08:00 via iPhone
    我会自己维护一个 tap,放指定版本的 rb 文件,专门自用,有多台机子也能用,很可靠。
    fffang
        3
    fffang  
    OP
       2021-05-25 19:06:29 +08:00
    brew 真的很坑。
    xingheng
        4
    xingheng  
       2021-05-26 08:20:32 +08:00
    @IgniteWhite #2 好奇一下你的 tap 是私有的吗? brew 能支持直接走 ssh 协议吗?
    IgniteWhite
        5
    IgniteWhite  
       2021-05-26 10:28:43 +08:00
    @xingheng 我放在 GitHub,公开的,只放了两个 cask: https://github.com/g6ai/homebrew-ale

    不清楚 SSH,官方做 tap 的文档建议用 GitHub,因为方便 homebrew 直接用 repo 名字来识别,tap 的时候不用输完整网址。

    如果在 GitHub 上做私有 tap,google 了一下看到了一个教程 https://gist.github.com/mlafeldt/8e7d50ee0b1de44e256d
    fffang
        6
    fffang  
    OP
       2021-05-26 20:20:23 +08:00
    @shyling 显示
    Cask 'grpc' is unreadable: wrong constant name #<Class:0x00007fb401956070>
    不知啥原因
    fffang
        7
    fffang  
    OP
       2021-05-26 20:21:19 +08:00
    @shyling
    brew install -s grpc.rb

    显示 Cask 'grpc' is unreadable: wrong constant name #<Class:0x00007fb401956070>
    然后又去下最新版本了

    ```
    class Grpc < Formula
    desc "Next generation open source RPC library and framework"
    homepage "https://grpc.io/"
    url "https://github.com/grpc/grpc.git",
    tag: "v1.32.0",
    revision: "414bb8322de2411eee1f4e841ff29d887bec7884",
    shallow: false
    license "Apache-2.0"
    revision 1
    head "https://github.com/grpc/grpc.git"

    livecheck do
    url "https://github.com/grpc/grpc/releases/latest"
    regex(%r{href=.*?/tag/v?(\d+(?:\.\d+)+)["' >]}i)
    end

    bottle do
    cellar :any
    rebuild 1
    sha256 "0588400a642f91dc3a04a51af045f20f47babc301f87ba8ffa5c7493c2e618a7" => :catalina
    sha256 "69135cd3114f1ea57d34be778a992c0e56e9d01253d8f48966e6f5cd51ccf6d3" => :mojave
    sha256 "47ccc49dab77f9844283f1edd05a82a4ae64b8f86fd8943b6580ee9fe4abf915" => :high_sierra
    end

    depends_on "autoconf" => :build
    depends_on "automake" => :build
    depends_on "cmake" => :build
    depends_on "libtool" => :build
    depends_on "abseil"
    depends_on "c-ares"
    depends_on "gflags"
    depends_on "[email protected]"
    depends_on "protobuf"
    depends_on "re2"

    def install
    mkdir "cmake/build" do
    args = %w[
    ../..
    -DBUILD_SHARED_LIBS=ON
    -DgRPC_BUILD_TESTS=OFF
    -DgRPC_INSTALL=ON
    -DgRPC_ABSL_PROVIDER=package
    -DgRPC_CARES_PROVIDER=package
    -DgRPC_PROTOBUF_PROVIDER=package
    -DgRPC_SSL_PROVIDER=package
    -DgRPC_ZLIB_PROVIDER=package
    -DgRPC_RE2_PROVIDER=package
    ] + std_cmake_args

    system "cmake", *args
    system "make", "install"

    args = %w[
    ../..
    -DCMAKE_EXE_LINKER_FLAGS=-lgflags
    -DCMAKE_SHARED_LINKER_FLAGS=-lgflags
    -DBUILD_SHARED_LIBS=ON
    -DgRPC_BUILD_TESTS=ON
    -DgRPC_GFLAGS_PROVIDER=package
    ] + std_cmake_args
    system "cmake", *args
    system "make", "grpc_cli"
    bin.install "grpc_cli"
    lib.install Dir["libgrpc++_test_config*.dylib"]
    end
    end

    test do
    (testpath/"test.cpp").write <<~EOS
    #include <grpc/grpc.h>
    int main() {
    grpc_init();
    grpc_shutdown();
    return GRPC_STATUS_OK;
    }
    EOS
    system ENV.cc, "test.cpp", "-I#{include}", "-L#{lib}", "-lgrpc", "-o", "test"
    system "./test"
    end
    end
    ```
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2897 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 13:56 · PVG 21:56 · LAX 06:56 · JFK 09:56
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.