200 字
1 分钟
macOS 安装 sshping
sshping 目前有:
- Rust 重写版(维护活跃,带 Homebrew tap 和 crates.io 包)
- 原始 C++ 版(仍可正常编译)
Rust 版本
cargo
cargo install sshping
# 自动放到 ~/.cargo/bin,记得加 PATH
sshping -V
Homebrew Tap
已静态链接 OpenSSL,无需额外依赖;支持 Apple Silicon 与 Intel。
brew tap TeddyHuang-00/app
brew install sshping
sshping -V
Rust 重写版维护者同时维护 tap,更新与 GitHub Releases 同步。
原始版
安装
1.安装依赖
brew install libssh
2.拉取并编译
git clone https://github.com/spook/sshping.git
cd sshping
# Intel Mac(/usr/local)通常直接 OK
make
# Apple Silicon:libssh 头文件在 /opt/homebrew
make LIBSSH_INCLUDE=/opt/homebrew/include/libssh/libssh.h
3.安装执行文件
sudo cp bin/sshping /usr/local/bin/
4.验证
sshping -h
常见报错与解决
报错/现象 | 原因 | 解决 |
---|---|---|
libssh/libssh.h not found | Apple Silicon 默认路径不符 | make LIBSSH_INCLUDE=/opt/homebrew/include/libssh/libssh.h |
ld: library not found for -lssh | libssh 未链接 | brew link libssh 或检查 LIBRARY_PATH |
参考链接
- Rust 版源仓库 https://github.com/TeddyHuang-00/sshping
- crates.io 包 https://crates.io/crates/sshping
- 原始 C++ 版 https://github.com/spook/sshping
macOS 安装 sshping
https://blog.lpkt.cn/posts/macos-install-sshping/