如何解决在 MacOS 上配置 Substrate
第一次做 Substrate 教程,但无法在网络上的其他地方找到答案 - 当我尝试加载 Substrate 框架时出现此错误:
$ curl https://getsubstrate.io -sSf | bash -s -- --fast
Mac OS (Darwin) detected.
==> Checking for `sudo` access (which may request your password).
Need sudo access on macOS (e.g. the user patrickburns needs to be an Administrator)!
在 sys 首选项中更改为 root 用户并重试:
$ curl https://getsubstrate.io -sSf | bash -s -- --fast
Mac OS (Darwin) detected.
==> Checking for `sudo` access (which may request your password).
Don't run this as root!
任何有关从 macOS 获得许可以执行请求的最佳方式的想法都非常感谢。
解决方法
您可以尝试运行脚本本身的行。
#!/bin/bash
# Copyright 2015-2020 Parity Technologies (UK) Ltd.
if [[ "$OSTYPE" == "linux-gnu" ]]; then
set -e
if [[ $(whoami) == "root" ]]; then
MAKE_ME_ROOT=
else
MAKE_ME_ROOT=sudo
fi
if [ -f /etc/redhat-release ]; then
echo "Redhat Linux detected."
echo "This OS is not supported with this script at present. Sorry."
echo "Please refer to https://github.com/paritytech/substrate for setup information."
exit 1
elif [ -f /etc/SuSE-release ]; then
echo "Suse Linux detected."
echo "This OS is not supported with this script at present. Sorry."
echo "Please refer to https://github.com/paritytech/substrate for setup information."
exit 1
elif [ -f /etc/arch-release ]; then
echo "Arch Linux detected."
$MAKE_ME_ROOT pacman -Syu --needed --noconfirm cmake gcc openssl-1.0 pkgconf git clang
export OPENSSL_LIB_DIR="/usr/lib/openssl-1.0";
export OPENSSL_INCLUDE_DIR="/usr/include/openssl-1.0"
elif [ -f /etc/mandrake-release ]; then
echo "Mandrake Linux detected."
echo "This OS is not supported with this script at present. Sorry."
echo "Please refer to https://github.com/paritytech/substrate for setup information."
exit 1
elif [ -f /etc/debian_version ]; then
echo "Ubuntu/Debian Linux detected."
$MAKE_ME_ROOT apt update
$MAKE_ME_ROOT apt install -y cmake pkg-config libssl-dev git gcc build-essential git clang libclang-dev
else
echo "Unknown Linux distribution."
echo "This OS is not supported with this script at present. Sorry."
echo "Please refer to https://github.com/paritytech/substrate for setup information."
exit 1
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
set -e
echo "Mac OS (Darwin) detected."
if ! which brew >/dev/null 2>&1; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
fi
brew update
brew install openssl cmake llvm
elif [[ "$OSTYPE" == "freebsd"* ]]; then
echo "FreeBSD detected."
echo "This OS is not supported with this script at present. Sorry."
echo "Please refer to https://github.com/paritytech/substrate for setup information."
exit 1
else
echo "Unknown operating system."
echo "This OS is not supported with this script at present. Sorry."
echo "Please refer to https://github.com/paritytech/substrate for setup information."
exit 1
fi
if ! which rustup >/dev/null 2>&1; then
curl https://sh.rustup.rs -sSf | sh -s -- -y
source ~/.cargo/env
rustup default stable
else
rustup update
rustup default stable
fi
rustup update nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
if [[ "$1" == "--fast" ]]; then
echo "Skipped cargo install of 'substrate' and 'subkey'"
echo "You can install manually by cloning the https://github.com/paritytech/substrate repo,"
echo "and using cargo to install 'substrate' and 'subkey' from the repo path."
else
g=$(mktemp -d)
git clone https://github.com/paritytech/substrate "$g"
pushd "$g"
cargo install --force --path ./bin/node/cli #substrate
cargo install --force --path ./bin/utils/subkey subkey
popd
fi
echo "Run source ~/.cargo/env now to update environment"
专门针对 MacOS:
brew update
brew install openssl cmake llvm
curl https://sh.rustup.rs -sSf | sh -s -- -y
source ~/.cargo/env
rustup default stable
rustup update nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。