Skip to content

QuincySnow/dev-setup

Repository files navigation

dev-setup

一键搭建开发环境:macOS/Linux 自动化配置脚本

License: MIT Platform Shell

English | 中文


简介

dev-setup 是一个一键脚本,帮助你在 macOS 或 Linux 上快速搭建完整的开发环境。

特性

  • 🚀 一键安装:运行 ./install.sh 即可完成所有配置
  • 🖥️ 跨平台:支持 macOS (Homebrew) 和 Linux (apt)
  • 🐟/🦔 多 Shell 支持:可选 Fish Shell 或 Zsh
  • 📦 可选模块:Docker、AI 工具、Python 工具链
  • 🔒 安全:自动备份旧配置,检查依赖
  • 🎨 开箱即用:预配置的 dotfiles,基于 我的博客 主题

快速开始

交互式安装

git clone https://github.com/SKIPPINGpetticoatconvent/dev-setup.git
cd dev-setup
./install.sh

指定 Shell 安装

# 安装 Fish Shell
./install.sh --shell fish

# 安装 Zsh
./install.sh --shell zsh

带模块安装

# 安装 Fish + Docker + AI
./install.sh --shell fish --with-docker --with-ai

# 安装 Zsh + Python 工具
./install.sh --shell zsh --with-python

非交互式安装

./install.sh --shell fish --with-docker --with-ai --with-python --yes

一行命令安装

curl -sSL https://raw.githubusercontent.com/SKIPPINGpetticoatconvent/dev-setup/main/install.sh | bash

使用说明

命令行选项

选项 说明
--shell {fish|zsh} 选择 Shell(默认:交互式选择)
--with-docker 安装 Docker
--with-ai 安装 AI 工具 (Ollama)
--with-python 安装 Python 工具 (uv, pipx)
--yes, -y 跳过所有确认
--skip-modules 跳过可选模块
--help 显示帮助

安装流程

  1. 检测 OS:自动识别 macOS 或 Linux
  2. 安装核心工具:git, curl, wget, unzip
  3. 安装 Shell:Fish (推荐) 或 Zsh
  4. 安装效率工具:starship, fzf, tmux
  5. 安装可选模块:Docker, AI, Python
  6. 配置 Dotfiles:自动链接配置文件

已安装工具

Shell & 终端

  • Fish Shell - 现代 Shell,开箱即用
  • Zsh - 强大的可扩展 Shell
  • Oh My Zsh - Zsh 框架(选择 Zsh 时)
  • Fisher - Fish 插件管理器
  • Starship - 跨 Shell 提示符
  • fzf - 模糊搜索
  • tmux - 终端复用器

开发工具

  • Git - 版本控制
  • Neovim - 现代文本编辑器
  • Bat - 带语法高亮的 cat 替代品
  • Eza/Exa - 现代 ls 替代品
  • Ripgrep - 高性能搜索
  • FD - 现代 find 替代品
  • HTop - 系统监控

可选模块

Docker

  • Docker Engine
  • Docker Compose
  • 免 sudo 配置

AI 工具

  • Ollama - 本地 LLM 运行
  • 可选:Open WebUI

Python 工具

  • uv - 极速包管理器
  • pipx - CLI 工具管理
  • Rye - Python 版本管理(可选)

Dotfiles 结构

dotfiles/
├── fish/
│   ├── config.fish          # Fish 主配置
│   └── functions/          # 自定义函数
├── zsh/
│   ├── .zshrc              # Zsh 主配置
│   └── .p10k.zsh           # Powerlevel10k
├── starship.toml           # Starship 配置
├── fzf/                    # fzf 快捷键
├── tmux.conf               # tmux 配置
├── gitconfig               # Git 配置
└── vimrc                   # Vim 配置

截图

截图占位符(安装完成后欢迎贡献截图)


配置

修改 Git 配置

安装完成后,编辑 ~/.gitconfig 填入你的信息:

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

自定义 Shell 插件

Fish:编辑 ~/.config/fish/config.fish

Zsh:编辑 ~/.zshrc,修改 plugins 数组


故障排除

Homebrew 未安装

# macOS
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Linux
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Docker 权限问题

sudo usermod -aG docker $USER
# 重新登录使更改生效

Starship 主题问题

# 重新初始化
starship preset gruvbox-rainbow > ~/.config/starship.toml

相关博客

本脚本的安装步骤与本站以下博客文章一致,更多细节与故障排查请直接参考对应文章:

🔗 Skipping Petticoat Convent


测试

完整测试套件已全部跑通,无错误。

  • 快速测试(无 Docker,约 1 秒):./tests/run_tests.sh./tests/e2e.sh
  • Docker 最小 E2E(单容器,仅 fish):E2E_DOCKER=1 ./tests/run_tests.sh
  • 完整测试(含多工具容器验证):E2E_DOCKER_FULL=1 ./tests/run_tests.sh

可选 bats 用于额外 CLI/库用例(安装后自动在 run_tests.sh 中执行)。详见 tests/README.md


贡献

欢迎提交 Issue 和 Pull Request!

  1. Fork 本仓库
  2. 创建分支 (git checkout -b feature/amazing-feature)
  3. 提交更改 (git commit -m 'Add amazing feature')
  4. 推送分支 (git push origin feature/amazing-feature)
  5. 打开 Pull Request

许可证

本项目采用 MIT 许可证 - 详见 LICENSE 文件


致谢


Made with ❤️ by SKIPPINGpetticoatconvent

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages