---
title: "环境准备"
url: "https://goframe.org/docs/micro-service/prepare-environment"
markdown_url: "https://goframe.org/docs/micro-service/prepare-environment.md"
locale: "zh-Hans"
version: "2.10.x(Latest)"
section: "微服务开发"
category: "微服务开发"
published: "2024-10-21"
updated: "2026-02-11"
description: "介绍GoFrame微服务开发的环境准备工作，包括gRPC协议的依赖安装指南、protoc工具的配置方法、protoc-gen-go和protoc-gen-go-grpc插件的安装，以及GoFrame框架CLI工具（v2.4+版本）的准备工作，帮助开发者快速搭建微服务开发环境。"
keywords: ["环境准备", "微服务", "GRPC协议", "GoFrame", "GoFrame框架", "依赖安装", "CLI开发工具", "protoc工具", "框架工具", "协议支持"]
---

# 环境准备

后续微服务章节主要以 `gRPC` 协议为主，介绍微服务的开发、组件及工具使用。

## 依赖安装

在进一步学习之前，请先了解 `gRPC` 相关概念，并在本地开发环境中安装对应的工具：

- [https://grpc.io/](https://grpc.io/)
- [https://grpc.io/docs/languages/go/quickstart/](https://grpc.io/docs/languages/go/quickstart/)

如果是 `MacOS` 环境，可以考虑使用 `brew` 工具安装依赖：

```
brew install grpc protoc-gen-go protoc-gen-go-grpc
```

依赖工具安装完成后，请参考 [https://grpc.io/docs/languages/go/quickstart/](https://grpc.io/docs/languages/go/quickstart/) 章节完成基础的 `protoc` 工具使用学习。

## 框架工具

`GoFrame` 框架的 `CLI` 开发工具请保证版本 `>= v2.4`。工具安装、升级请参考章节：[开发工具](https://goframe.org/docs/cli)

框架工具针对 `GRPC` 协议，提供了额外的命令支持，极大地简化了基于 `GRPC` 协议的微服务开发。
