Files
nexus/raw/Home Office/macOS 创建与解除 Symbolic Link(OpenClaw 目录映射).md

191 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: 1 创建 Symbolic Link
source:
author: shenwei
published:
created:
description:
tags: [obsidian, openclaw, symbolic-link]
---
#symbolic-link #obsidian #openclaw
下面是一份可以直接放进 **Obsidian** 的 Markdown 笔记,用于记录 **macOS 创建 / 解除 Symbolic Link符号链接** 的操作。
## 背景
OpenClaw 默认使用隐藏目录:
```
~/.openclaw
```
该目录不方便在 **Finder 或 Obsidian** 中直接作为 Vault 使用。
解决方法是创建一个 **Symbolic Link符号链接**,把隐藏目录映射为普通目录:
```
~/openclaw
```
这样:
- OpenClaw 继续使用 `~/.openclaw`
- Obsidian 可以使用 `~/openclaw`
- 两者访问的是 **同一份数据**
---
# 1 创建 Symbolic Link
在 Terminal 执行:
```bash
ln -s /Users/weishen/.openclaw /Users/weishen/openclaw
```
或使用 `~`
```bash
ln -s ~/.openclaw ~/openclaw
```
执行后目录结构变为:
```
~/openclaw -> ~/.openclaw
```
---
# 2 验证 Symbolic Link
查看链接:
```bash
ls -l ~ | grep openclaw
```
示例输出:
```
openclaw -> /Users/weishen/.openclaw
```
查看链接指向:
```bash
readlink ~/openclaw
```
---
# 3 在 Obsidian 中使用
打开 Obsidian
```
Open folder as vault
```
选择:
```
/Users/weishen/openclaw
```
Obsidian 即可访问 OpenClaw 的 Markdown 文件。
---
# 4 解除 Symbolic Link删除映射
如果需要取消映射,只需要删除链接:
```bash
rm ~/openclaw
```
或者:
```bash
rm /Users/weishen/openclaw
```
⚠️ 该操作 **只会删除链接文件,不会删除真实目录**
---
# 5 验证解除成功
检查链接是否存在:
```bash
ls -l ~ | grep openclaw
```
如果没有输出,说明链接已经删除。
真实目录仍然存在:
```bash
ls ~/.openclaw
```
---
# 6 注意事项
不要误删真实目录:
```
rm -rf ~/.openclaw
```
该命令会 **删除 OpenClaw 数据目录**
---
# 7 推荐的长期目录结构
为了更方便管理,可以采用如下结构:
```
~/openclaw
├── agents
├── skills
├── memory
├── prompts
├── logs
└── docs
```
然后创建反向链接:
```bash
ln -s ~/openclaw ~/.openclaw
```
这样:
```
~/openclaw # 实际目录
~/.openclaw -> ~/openclaw
```
优点:
- Finder / Obsidian 可直接访问
- OpenClaw 兼容原路径
- 方便 Git 管理与备份
---
如果需要,我还可以帮你整理一套 **OpenClaw + Obsidian 的完整知识库结构Agent Memory / Skills / Prompts / Runbooks**,非常适合你现在的 **多服务器 OpenClaw Agent 管理场景**