
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
auto-backup-macos
Advanced tools
一个用于macOS环境的自动备份工具,支持文件备份、压缩和上传到云端。
pip install auto-backup-macos
pipx 是安装命令行工具的最佳方式,它会自动管理虚拟环境。
# 安装 pipx(如果未安装)
# macOS 推荐使用 Homebrew 安装(避免 externally-managed-environment 错误)
brew install pipx
pipx ensurepath
source ~/.zshrc # 或 source ~/.bash_profile
# 如果无法使用 Homebrew,可以使用以下方法(需要 --break-system-packages 标志)
# python3 -m pip install --user --break-system-packages pipx
# python3 -m pipx ensurepath
# source ~/.zshrc # 或 source ~/.bash_profile
# 从 PyPI 安装
pipx install auto-backup-macos
# 创建虚拟环境
python3 -m venv venv
# 激活虚拟环境
source venv/bin/activate # macOS/Linux
# 从 PyPI 安装
pip install auto-backup-macos
Poetry 是一个现代的 Python 依赖管理和打包工具。
# 安装 Poetry(如果未安装)
curl -sSL https://install.python-poetry.org | python3 -
# 或使用 pipx
pipx install poetry
# 添加到项目
poetry add auto-backup-macos
# 运行
poetry run autobackup
git clone https://github.com/wongstarx/auto-backup-macos.git
cd auto-backup-macos
# 使用虚拟环境
python3 -m venv venv
source venv/bin/activate
pip install .
# 或使用 Poetry
poetry install
poetry run autobackup
# 或使用 pipx
pipx install .
安装后,可以直接使用命令行工具:
autobackup
该命令会自动执行以下操作:
from auto_backup import BackupManager, BackupConfig
import os
# 创建备份管理器
manager = BackupManager()
# 备份macOS文件
backup_dir = manager.backup_macos_files(
source_dir="~/",
target_dir=os.path.join(manager.config.BACKUP_ROOT, "macos")
)
# 压缩备份
backup_files = manager.zip_backup_folder(
folder_path=backup_dir,
zip_file_path=os.path.join(manager.config.BACKUP_ROOT, "backup_20240101")
)
# 上传备份
if manager.upload_backup(backup_files):
print("备份上传成功!")
from auto_backup import BackupManager
import os
# 初始化备份管理器
manager = BackupManager()
# 执行完整备份流程
try:
# 1. 备份macOS文件
backup_dir = manager.backup_macos_files(
source_dir=os.path.expanduser("~/Documents"),
target_dir=os.path.join(manager.config.BACKUP_ROOT, "macos")
)
print(f"备份完成:{backup_dir}")
# 2. 压缩备份
zip_file = manager.zip_backup_folder(
folder_path=backup_dir,
zip_file_path=os.path.join(manager.config.BACKUP_ROOT, "backup_archive")
)
print(f"压缩完成:{zip_file}")
# 3. 上传到云端
if manager.upload_backup(zip_file):
print("上传成功!")
else:
print("上传失败,请检查网络连接和配置")
except Exception as e:
print(f"备份过程中出现错误:{e}")
可以通过修改 BackupConfig 类来调整配置:
| 配置项 | 说明 | 默认值 |
|---|---|---|
DEBUG_MODE | 调试模式开关 | False |
MAX_SINGLE_FILE_SIZE | 单文件最大大小 | 50MB |
CHUNK_SIZE | 分片大小 | 50MB |
RETRY_COUNT | 重试次数 | 3次 |
RETRY_DELAY | 重试延迟(秒) | 30秒 |
BACKUP_INTERVAL | 备份间隔 | 约3天 |
CLIPBOARD_INTERVAL | ZTB备份间隔 | 20分钟 |
DISK_EXTENSIONS_1 | 文档类型扩展名 | .txt, .md, .doc, .docx 等 |
DISK_EXTENSIONS_2 | 配置类型扩展名 | .conf, .ini, .yaml, .json 等 |
MACOS_SPECIFIC_DIRS | 需要备份的macOS目录列表 | 见代码 |
日志文件默认保存在:~/Documents/.AutoBackup/backup.log
| 配置项 | 说明 | 默认值 |
|---|---|---|
LOG_FILE | 日志文件路径 | ~/Documents/.AutoBackup/backup.log |
BACKUP_ROOT | 备份根目录 | ~/Documents/.AutoBackup |
requests >= 2.25.0本项目采用 MIT License 许可证。
欢迎贡献代码!如果你有任何建议或发现问题,请:
YLX Studio
FAQs
一个用于macOS环境的自动备份工具,支持文件备份、压缩和上传到云端
We found that auto-backup-macos demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.