You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MacOS无sha256sum工具:High Sierra下MacPorts安装失败求助

Hey there! Let's tackle this sha256sum issue on macOS High Sierra step by step.

快速替代方案:用系统自带的shasum

You don't even need to install anything first—macOS comes with a built-in tool called shasum that can do exactly what sha256sum does. Just run:

shasum -a 256 [your-file-path]

If you want output that matches sha256sum's exact format (like removing the asterisk before filenames), add the --binary flag:

shasum -a 256 --binary [your-file-path]

For even more convenience, set up an alias so you can type sha256sum directly from now on:

echo 'alias sha256sum="shasum -a 256"' >> ~/.bash_profile
source ~/.bash_profile
Fixing MacPorts Installation Failures

If you really want the native GNU sha256sum tool, it's part of the coreutils package (not a standalone port). Let's troubleshoot the MacPorts issue:

  1. Update MacPorts first
    Outdated package indexes are a common culprit. Refresh MacPorts and its repo:
sudo port selfupdate

Then try installing coreutils again:

sudo port install coreutils

After installation, the GNU tools will have a g prefix (e.g., gsha256sum). To use sha256sum directly, add MacPorts' GNU bin directory to your PATH:

echo 'export PATH="/opt/local/libexec/gnubin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
  1. Install a compatible version for High Sierra
    High Sierra is an older macOS release, so some newer coreutils versions might not support it. Try installing a known-compatible version:
sudo port install coreutils @8.32_0
  1. Verify system permissions
    Make sure your /opt/local directory has the correct permissions (MacPorts needs this to install packages):
sudo chown -R root:wheel /opt/local
sudo chmod -R 755 /opt/local
Alternative: Use Homebrew instead

If MacPorts keeps giving you trouble, Homebrew tends to have better compatibility with older macOS versions. First install Homebrew (if you haven't already):

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then install coreutils:

brew install coreutils

Like with MacPorts, you'll get gsha256sum by default. To use sha256sum directly, add this to your profile:

echo 'export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

内容的提问来源于stack exchange,提问作者Rui F Ribeiro

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 10:32:36