Mac安装geth的记录

使用mac安装geth相对来说简单许多,本文就是对一些教程的整理。随着时间的推移,原来教程里的某些代码可能无法使用,所以本文就综合了几篇教程,完成了Mac安装geth的目的。

安装基础依赖

xcode-select --install
如果提示
xcode-select: error: command line tools are already installed, use “Software Update” to install updates
就是安装过了,跳过这一步,继续下一步。我这里就是已经安装过了。

安装包管理工具

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
这一步安装的是brew工具,有些命令我尝试过不可用,这一行安装命令截止到2022年4月还是可以用的。

安装以太坊和geth

brew updatebrew tap ethereum/ethereumbrew install ethereum

测试安装结果

geth --help
安装成功会显示下面信息,这是开头的一部分信息,没有全部列出来。

NAME:   geth - the go-ethereum command line interface   Copyright 2013-2022 The go-ethereum AuthorsUSAGE:   geth [options] [command] [command options] [arguments...]   VERSION:   1.10.17-stable   COMMANDS:   account                            Manage accounts   attach                             Start an interactive JavaScript environment (connect to node)   console                            Start an interactive JavaScript environment   db                                 Low level database operations   dump                               Dump a specific block from storage   dumpconfig                         Show configuration values   dumpgenesis                        Dumps genesis block JSON configuration to stdout   export                             Export blockchain into file   export-preimages                   Export the preimage database into an RLP stream   import                             Import a blockchain file   import-preimages                   Import the preimage database from an RLP stream   init                               Bootstrap and initialize a new genesis block   js                                 Execute the specified JavaScript files   license                            Display license information   makecache                          Generate ethash verification cache (for testing)   makedag                            Generate ethash mining DAG (for testing)   removedb                           Remove blockchain and state databases   show-deprecated-flags              Show flags that have been deprecated   snapshot                           A set of commands based on the snapshot   version                            Print version numbers   version-check                      Checks (online) whether the current version suffers from any known security vulnerabilities

发布本文主要是方便自己之后查看,如果能帮助到一两人更好。内容截取自下面三篇文章。
安装geth的过程参考自:
https://www.jianshu.com/p/12bc97d47516
brew管理工具的安装参考自:
https://www.cnblogs.com/liyihua/p/12753163.html
https://zhuanlan.zhihu.com/p/111014448