> For the complete documentation index, see [llms.txt](https://help.titanapp.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.titanapp.info/titan-network-zhong-wen/3-ce-ka-xi-ni-ce-shi-wang/yun-xing-jie-dian/l2-edge-jie-dian/yun-xing-jie-dian-zhuan-qu/ru-he-zai-macos-cli-shang-yun-xing-titan.md).

# 如何在 MacOS （CLI）上运行 Titan

{% hint style="danger" %}
**🚨重要提示🚨**

如果您是参与过Herschel测试网的用户，需要手动清理之前运行的节点数据。否则节点将无法运行🚨

**🔘**[**去清理**](/titan-network-zhong-wen/3-ce-ka-xi-ni-ce-shi-wang/yun-xing-jie-dian/l2-edge-jie-dian/yun-xing-jie-dian-zhuan-qu/lao-jie-dian-qing-li-zhi-nan/macoscli-jie-dian-shu-ju-qing-li.md)

*如果您之前从未运行过Titan节点，请直接参考下面的教程运行。*
{% endhint %}

{% hint style="info" %}
我们的 GitHub 上的 [**Releases**](https://github.com/Titannet-dao/titan-node/releases) 部分是获取最新二进制发布版本和查看源代码的最佳位置。
{% endhint %}

### 步骤 1：下载 CLI-Titan节点文件 <a href="#step-1-download-the-advanced-cli-executables" id="step-1-download-the-advanced-cli-executables"></a>

{% embed url="<https://github.com/Titannet-dao/titan-node/releases/download/v0.1.20/titan-edge_v0.1.20_246b9dd_mac_amd64.tar.gz>" %}

### 步骤 2：解压下载的文件 <a href="#step-1-download-the-advanced-cli-executables" id="step-1-download-the-advanced-cli-executables"></a>

```
tar -zxvf titan-edge_v0.1.20_246b9dd_mac_amd64.tar.gz
```

打开终端（Terminal），导航到下载文件所在的目录，然后执行以下命令进行解压：

### **步骤3: 进入解压后的目录**：

* 使用以下命令进入解压后的目录：

```
cd titan-edge_v0.1.20_246b9dd_mac_amd64
```

### **步骤4: 安装Titan Edge**：

* 将 `titan-edge` 可执行文件复制到系统的 `/usr/local/bin` 目录下，使其可以在任何地方运行：

```
sudo cp titan-edge /usr/local/bin
```

### **步骤5: 获取当前工作目录路径**：

* 运行以下命令获取当前目录的路径，并记下此路径：

```
pwd
```

* 假设获取的路径为 `x`

### **步骤6:** 更新动态库路径（一次性解决方案）

1. 在路径后面添加 `libgoworkerd.dylib`

* 假设上一步获取的路径为 `x`，则完整路径应为 `x/libgoworkerd.dylib`。

2. **更新 `titan-edge` 可执行文件中的动态库路径**

* 使用以下命令将路径替换为实际路径：

```
install_name_tool -change "@rpath/libgoworkerd.dylib" x/libgoworkerd.dylib /usr/local/bin/titan-edge
```

#### （临时解决方案）

如果您希望进行临时测试，您可以使用以下步骤：

**设置动态库路径环境变量**：

* 在终端中设置 `DYLD_LIBRARY_PATH` 环境变量为当前目录：

```
export DYLD_LIBRARY_PATH=.
```

> #### 注意事项
>
> * **权限问题**：在执行 `sudo` 命令时，您需要输入管理员密码。
> * **路径正确性**：请确保路径输入正确，以避免无法找到文件的问题。
> * **环境变量**：临时解决方案设置的环境变量仅在当前终端会话中有效，关闭终端后需要重新设置。

### 步骤7:启动 CLI

```
titan-edge daemon start --init --url https://cassini-locator.titannet.io:5000/rpc/v0
```

### **步骤 8:  👉**[**申请身份码**](/titan-network-zhong-wen/hui-geng-si-ce-shi-wang/huygens-testnet/an-zhuang-cheng-xu-zhuan-qu/bang-ding-shen-fen-ma.md)**👈**

### 步骤9:绑定身份码

*将申请到的 <mark style="color:red;">**身份码**</mark> 替换 <mark style="color:red;">**your-hash-here**</mark>*

```
titan-edge bind --hash=your-hash-here https://api-test1.container1.titannet.io/api/v2/device/binding
```

### **步骤10: 停止节点**

```
titan-edge daemon stop
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.titanapp.info/titan-network-zhong-wen/3-ce-ka-xi-ni-ce-shi-wang/yun-xing-jie-dian/l2-edge-jie-dian/yun-xing-jie-dian-zhuan-qu/ru-he-zai-macos-cli-shang-yun-xing-titan.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
