{"id":15640433,"url":"https://github.com/xuehaipan/dev-setup","last_synced_at":"2025-07-18T17:36:44.901Z","repository":{"id":39377141,"uuid":"219283029","full_name":"XuehaiPan/Dev-Setup","owner":"XuehaiPan","description":"Automation scripts for setting up a basic development environment.","archived":false,"fork":false,"pushed_at":"2025-07-09T08:30:06.000Z","size":19968,"stargazers_count":92,"open_issues_count":0,"forks_count":13,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-09T09:39:34.531Z","etag":null,"topics":["dotfiles","setup-development-environment","setup-linux","setup-macos","setup-script","vimrc","vscode-settings","zshrc"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/XuehaiPan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-11-03T10:20:40.000Z","updated_at":"2025-07-09T08:30:10.000Z","dependencies_parsed_at":"2024-02-25T09:24:31.945Z","dependency_job_id":"3fb58e55-4714-438e-97c7-79eff96e655a","html_url":"https://github.com/XuehaiPan/Dev-Setup","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/XuehaiPan/Dev-Setup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XuehaiPan%2FDev-Setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XuehaiPan%2FDev-Setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XuehaiPan%2FDev-Setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XuehaiPan%2FDev-Setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XuehaiPan","download_url":"https://codeload.github.com/XuehaiPan/Dev-Setup/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XuehaiPan%2FDev-Setup/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265802098,"owners_count":23830509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotfiles","setup-development-environment","setup-linux","setup-macos","setup-script","vimrc","vscode-settings","zshrc"],"created_at":"2024-10-03T11:35:24.344Z","updated_at":"2025-07-18T17:36:44.887Z","avatar_url":"https://github.com/XuehaiPan.png","language":"Shell","readme":"# Dev-Setup\n\n[中文版](README.zh-CN.md) 👈\n\nAutomation scripts for setting up a basic development environment. ([screenshots](#screenshots))\n\n## Table of Contents \u003c!-- omit in toc --\u003e\n\n- [Usage](#usage)\n  - [Installation](#installation)\n  - [Rollback](#rollback)\n  - [Upgrade Packages](#upgrade-packages)\n  - [Font Settings](#font-settings)\n- [Customization](#customization)\n- [Packages](#packages)\n- [Screenshots](#screenshots)\n\n## Usage\n\n### Installation\n\nDownload the script file using [wget](https://www.gnu.org/software/wget) / [curl](https://curl.haxx.se) / [git](https://git-scm.com) or any browser ([click here to download zip](https://codeload.github.com/XuehaiPan/Dev-Setup/zip/HEAD)). Open `Terminal` and run:\n\n**via wget**\n\n```bash\n# Download and run via wget\n/bin/bash -c \"$(wget -O - https://github.com/XuehaiPan/Dev-Setup/raw/HEAD/setup.sh)\"\n```\n\n**via curl**\n\n```bash\n# Download and run via curl\n/bin/bash -c \"$(curl -fL https://github.com/XuehaiPan/Dev-Setup/raw/HEAD/setup.sh)\"\n```\n\n**via git or browser**\n\n```bash\n# Download via git\ngit clone --depth=1 https://github.com/XuehaiPan/Dev-Setup.git\n\n# Run the script file\ncd Dev-Setup\n/bin/bash setup.sh\n```\n\nOptions:\n\n- `SET_MIRRORS` (default `false`): set the source of package managers to open source mirrors at [TUNA (@China)](https://mirrors.tuna.tsinghua.edu.cn) to speed up downloading. (see [Packages](#packages) for more details). If you want to bypass the prompt, run:\n\n  ```bash\n  # Bypass the prompt\n  SET_MIRRORS=true bash setup.sh    # set mirrors to TUNA (@China) (recommended for users in China)\n  SET_MIRRORS=false bash setup.sh   # do not modify mirror settings\n  ```\n\n**Note**: If you are using **WSL on Windows**, you need to run [Windows Terminal](https://github.com/Microsoft/Terminal) as **administrator** to get the permissions to copy fonts to `C:\\Windows\\Fonts`. Otherwise, the fonts will not be installed successfully on Windows. You can download them from [nerdfonts.com](https://www.nerdfonts.com) and install them manually. See [Font Settings](#font-settings) for more details.\n\nAfter running the script, all the old configuration files involved will be backed up to the folder `${HOME}/.dotfiles/backups/\u003cDATETIME\u003e`, and a symbolic link `${HOME}/.dotfiles/backups/latest` will link to the latest one. You can compare the differences using:\n\n```bash\n# Compare the differences\ncolordiff -uEB ~/.dotfiles/backups/latest ~/.dotfiles\ncolordiff -uEB ~/.dotfiles/backups/latest/.dotfiles ~/.dotfiles\n\n# Ignore miscellaneous directories\ncolordiff -uEB -x 'backups' -x '.dotfiles' ~/.dotfiles/backups/latest ~/.dotfiles\ncolordiff -uEB -x 'backups' ~/.dotfiles/backups/latest/.dotfiles ~/.dotfiles\n```\n\nThere is a nice way to inspect and move changes from one version to another version of the same file using [`vimdiff`](https://www.vim.org) or [`meld`](http://meldmerge.org). Run:\n\n```bash\n# Inspect and move changes using vimdiff\nvim -c \"DirDiff ~/.dotfiles ~/.dotfiles/backups/latest/.dotfiles\"\n```\n\nYou can get vimdiff reference manual from [https://vimhelp.org/diff.txt.html](https://vimhelp.org/diff.txt.html), or type command `:help diff` inside Vim.\n\n### Rollback\n\nYou can rollback to your previous dotfiles using:\n\n```bash\n# Rollback to the latest backup in \"${HOME}/.dotfiles/backups/latest\"\nbash restore_dotfiles.sh\n\n# Rollback to a specific version\nbash restore_dotfiles.sh \"${HOME}/.dotfiles/backups/\u003cDATETIME\u003e\"\n```\n\n**Note**: the packages installed by [`setup.sh`](setup.sh) (see [Packages](#packages)) will remain in your system.\n\n### Upgrade Packages\n\nYou can upgrade your packages just by running:\n\n```bash\nupgrade_packages\n```\n\nBy default, `upgrade_packages` will not upgrade your conda environments. If you want to always keep your conda up-to-date, you can uncomment the corresponding line in `${HOME}/.dotfiles/utilities.sh`. Or run the script as:\n\n```bash\nupgrade_packages; upgrade_conda\n```\n\n### Font Settings\n\nThe login shell for the current user will be set to **`zsh`**. In order to get a wonderful and enjoyable terminal experience, please change your terminal font to a [**Nerd Font**](https://github.com/ryanoasis/nerd-fonts). You can download any nerd font you like from [nerdfonts.com](https://www.nerdfonts.com) manually. The script will download and install [**`DejaVu Sans Mono Nerd Font`**](https://github.com/ryanoasis/nerd-fonts/blob/HEAD/patched-fonts/DejaVuSansMono) for **macOS**, **Linux** and **Windows** (**administrator privilege** is required to install fonts on Windows).\n\nConfigure your terminal to use nerd fonts:\n\n- For macOS and Linux users, change the terminal font setting to \"Nerd Font Complete\" (e.g. `'DejaVuSansM Nerd Font Book'`).\n- For WSL on Windows users, change the terminal font setting to \"Nerd Font Complete Windows Compatible\" (e.g. `'DejaVuSansMono NF'`).\n\nSee [Font configurations for Powerlevel10k](https://github.com/romkatv/powerlevel10k#fonts) for more details.\n\nOr use Zsh with Powerlevel10k Lean style:\n\n```bash\nchsh -s /usr/local/bin/zsh-lean   # change the login shell\n```\n\nwhich do not need additional font settings.\n\n![zsh-lean](https://user-images.githubusercontent.com/16078332/102495805-8cc45c00-40b1-11eb-8838-b5b64c434d33.png)\n\n**Note**: If you are using **WSL on Windows**, you need to run [Windows Terminal](https://github.com/Microsoft/Terminal) as **administrator** to get the permissions to copy fonts to `C:\\Windows\\Fonts`. If you forgot to obtain the appropriate privileges, you can open WSL in a new terminal window with administrator privilege. Then run the following command:\n\n```bash\nfind -L ~/.local/share/fonts -not -empty -type f -name '*.tt[fc]' -print0 | xargs -0 -I '{}' bash -c \\\n    'file=\"{}\"\n    font=${file##*/}\n    echo \"Installing \\\"${font}\\\" to \\\"/mnt/c/Windows/Fonts\\\"\"\n    cp -f \"${file}\" /mnt/c/Windows/Fonts\n    /mnt/c/Windows/System32/reg.exe add \"HKLM\\\\SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\\\\Fonts\" \\\n        /v \"${font%.tt[fc]} (TrueType)\" /t REG_SZ /d \"${font}\" /f'\n```\n\n## Customization\n\nMake your own setup scripts. Add a new config file to the script:\n\n1. fork this repository;\n2. copy the contents of your config file to a temp file `temp.txt`;\n3. replace all identifiers of your home directory with `${HOME}` in `temp.txt`;\n4. replace all identifiers of your user name with `${USER}` in `temp.txt`;\n5. replace all `\\` with `\\\\` in `temp.txt`;\n6. replace all `$` with `\\$` in `temp.txt`;\n7. add the following lines to script `setup_\u003cOS_NAME\u003e.sh`:\n\n```bash\ncd \"${HOME}\"   # this line has already been added at the top of the script\n\n# Replace \u003cCFG_FILE\u003e with the config file's name\nbackup_dotfiles \u003cCFG_FILE\u003e .dotfiles/\u003cCFG_FILE\u003e\n\ncat \u003e.dotfiles/\u003cCFG_FILE\u003e \u003c\u003cEOF\n# Paste the contents in the temp file `temp.txt` here\nEOF\n\nln -sf .dotfiles/\u003cCFG_FILE\u003e .\n```\n\n8. add `\u003cCFG_FILE\u003e` and `.dotfiles/\u003cCFG_FILE\u003e` to `DOTFILES` in [`restore_dotfiles.sh`](restore_dotfiles.sh#L12).\n\n## Packages\n\nThe source of package managers (Homebrew (macOS), APT (Ubuntu), Pacman (Manjaro), CPAN, Gem, Conda and Pip) will be set to the open source mirrors at [TUNA (@China)](https://mirrors.tuna.tsinghua.edu.cn).\n\nThe following packages will be setup:\n\n| Package                                                                                                                          | macOS | Ubuntu Linux | Manjaro Linux |\n| :------------------------------------------------------------------------------------------------------------------------------- | :---: | :----------: | :-----------: |\n| [Mirrors at TUNA (@China)](https://mirrors.tuna.tsinghua.edu.cn)                                                                 |   ✔   |      ✔       |       ✔       |\n| [Homebrew](https://brew.sh)                                                                                                      |   ✔   |      ✔       |       ✔       |\n|                                                                                                                                  |       |              |               |\n| [bash](https://www.gnu.org/software/bash)                                                                                        |   ✔   |      ✔       |       ✔       |\n| [bash-completion](https://salsa.debian.org/debian/bash-completion)                                                               |   ✔   |      ✔       |       ✔       |\n| [zsh](http://zsh.sourceforge.net) \u0026 [oh-my-zsh](https://ohmyz.sh)                                                                |   ✔   |      ✔       |       ✔       |\n| [powerlevel10k](https://github.com/romkatv/powerlevel10k)                                                                        |   ✔   |      ✔       |       ✔       |\n| [zsh-syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting)                                                  |   ✔   |      ✔       |       ✔       |\n| [zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions)                                                          |   ✔   |      ✔       |       ✔       |\n| [zsh-completions](https://github.com/zsh-users/zsh-completions)                                                                  |   ✔   |      ✔       |       ✔       |\n| [colorls](https://github.com/athityakumar/colorls)                                                                               |   ✔   |      ✔       |       ✔       |\n|                                                                                                                                  |       |              |               |\n| [git](https://git-scm.com) \u0026 [git-lfs](https://git-lfs.github.com)                                                               |   ✔   |      ✔       |       ✔       |\n| [vim](https://www.vim.org) \u0026 [vim-plug](https://github.com/junegunn/vim-plug)                                                    |   ✔   |      ✔       |       ✔       |\n| [tmux](https://github.com/tmux/tmux/wiki) \u0026 [oh-my-tmux](https://github.com/gpakosz/.tmux)                                       |   ✔   |      ✔       |       ✔       |\n| [reattach-to-user-namespace](https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard) / [xclip](https://github.com/astrand/xclip) |   ✔   |      ✔       |       ✔       |\n|                                                                                                                                  |       |              |               |\n| [fzf](https://github.com/junegunn/fzf)                                                                                           |   ✔   |      ✔       |       ✔       |\n| [ranger](https://ranger.github.io)                                                                                               |   ✔   |      ✔       |       ✔       |\n| [fd](https://github.com/sharkdp/fd)                                                                                              |   ✔   |      ✔       |       ✔       |\n| [bat](https://github.com/sharkdp/bat)                                                                                            |   ✔   |      ✔       |       ✔       |\n| [highlight](http://www.andre-simon.de/doku/highlight/en/highlight.php)                                                           |   ✔   |      ✔       |       ✔       |\n| [ripgrep](https://github.com/BurntSushi/ripgrep)                                                                                 |   ✔   |      ✔       |       ✔       |\n|                                                                                                                                  |       |              |               |\n| [wget](https://www.gnu.org/software/wget)                                                                                        |   ✔   |      ✔       |       ✔       |\n| [curl](https://curl.haxx.se)                                                                                                     |   ✔   |      ✔       |       ✔       |\n| [openssh](https://www.ssh.com/ssh/openssh)                                                                                       |   ✔   |      ✔       |       ✔       |\n| [ruby](https://www.ruby-lang.org/en) \u0026 [rubygems](https://rubygems.org)                                                          |   ✔   |      ✔       |       ✔       |\n| [perl](https://www.perl.org) \u0026 [cpan](https://www.cpan.org)                                                                      |   ✔   |      ✔       |       ✔       |\n| [htop](https://hisham.hm/htop)                                                                                                   |   ✔   |      ✔       |       ✔       |\n| [net-tools](https://sourceforge.net/projects/net-tools)                                                                          |   ✔   |      ✔       |       ✔       |\n| [atool](https://www.nongnu.org/atool/)                                                                                           |   ✔   |      ✔       |       ✔       |\n| [tree](http://mama.indstate.edu/users/ice/tree/)                                                                                 |   ✔   |      ✔       |       ✔       |\n| [git-extras](https://github.com/tj/git-extras)                                                                                   |   ✔   |      ✔       |       ✔       |\n| [diffutils](https://www.gnu.org/software/diffutils)                                                                              |   ✔   |      ✔       |       ✔       |\n| [colordiff](https://www.colordiff.org)                                                                                           |   ✔   |      ✔       |       ✔       |\n| [diff-so-fancy](https://github.com/so-fancy/diff-so-fancy)                                                                       |   ✔   |      ✔       |       ✔       |\n| [delta](https://github.com/dandavison/delta)                                                                                     |   ✔   |      ✔       |       ✔       |\n| [jq](https://stedolan.github.io/jq)                                                                                              |   ✔   |      ✔       |       ✔       |\n| [shfmt](https://github.com/mvdan/sh)                                                                                             |   ✔   |      ✔       |       ✔       |\n| [shellcheck](https://www.shellcheck.net)                                                                                         |   ✔   |      ✔       |       ✔       |\n|                                                                                                                                  |       |              |               |\n| [Miniconda3](https://docs.conda.io/en/latest/miniconda.html)                                                                     |   ✔   |      ✔       |       ✔       |\n| [mamba](https://github.com/mamba-org/mamba)                                                                                      |   ✔   |      ✔       |       ✔       |\n| [gcc](https://gcc.gnu.org)                                                                                                       |   ✔   |      ✔       |       ✔       |\n| [gdb](https://www.gnu.org/software/gdb)                                                                                          |   ✔   |      ✔       |       ✔       |\n| [clang](https://clang.llvm.org) \u0026 [llvm](https://llvm.org)                                                                       |   ✔   |      ✔       |       ✔       |\n| [lldb](http://lldb.llvm.org)                                                                                                     |   ✔   |      ✔       |       ✔       |\n| [make](https://www.gnu.org/software/make)                                                                                        |   ✔   |      ✔       |       ✔       |\n| [cmake](https://cmake.org)                                                                                                       |   ✔   |      ✔       |       ✔       |\n|                                                                                                                                  |       |              |               |\n| [DejaVu Sans Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/HEAD/patched-fonts/DejaVuSansMono)                     |   ✔   |      ✔       |       ✔       |\n| [Cascadia Code Font](https://github.com/microsoft/cascadia-code)                                                                 |   ✔   |      ✔       |       ✔       |\n| [Menlo Font](https://github.com/XuehaiPan/Dev-Setup/blob/HEAD/fonts)                                                             |   ✔   |      ✔       |       ✔       |\n| [Microsoft YaHei Mono Font](https://github.com/XuehaiPan/Dev-Setup/blob/HEAD/fonts)                                              |   ✔   |      ✔       |       ✔       |\n\nCurrently macOS only casks installed by Homebrew:\n\n| Package                                                   | Description                                                                                | macOS | Ubuntu / Manjaro Linux |\n| :-------------------------------------------------------- | ------------------------------------------------------------------------------------------ | :---: | :--------------------: |\n| [iTerm2](https://iterm2.com)                              | A terminal emulator for macOS that does amazing things                                     |   ✔   |           ✘            |\n| [Google Chrome](https://www.google.com/chrome/index.html) | A fast, secure, and free web browser built for the modern web                              |   ✔   |           ✘            |\n| [Keka](https://www.keka.io)                               | The macOS file archiver                                                                    |   ✔   |           ✘            |\n| [IINA](https://iina.io)                                   | The modern media player for macOS                                                          |   ✔   |           ✘            |\n| [Typora](https://typora.io)                               | A truly minimal markdown editor                                                            |   ✔   |           ✘            |\n| [Visual Studio Code](https://code.visualstudio.com)       | A lightweight but powerful source code editor                                              |   ✔   |           ✘            |\n| [XQuartz](https://www.xquartz.org)                        | An open-source effort to develop a version of the X.Org X Window System that runs on macOS |   ✔   |           ✘            |\n\n## Screenshots\n\nShell:\n\n![shell](https://user-images.githubusercontent.com/16078332/101635454-f6ff5000-3a64-11eb-9b4a-af674432dc69.png)\n\ntmux:\n\n![tmux](https://user-images.githubusercontent.com/16078332/102495801-8afa9880-40b1-11eb-9d3f-5045c37fd576.png)\n\nfzf:\n\n![fzf](https://user-images.githubusercontent.com/16078332/101661628-7ac83500-3a83-11eb-80a1-77c772abe2a4.gif)\n\nVim:\n\n![vim](https://user-images.githubusercontent.com/16078332/101630446-d7b0f480-3a5d-11eb-9d2a-af9d09f0d2c0.png)\n\nLive markdown preview support for Vim:\n\n![markdown](https://user-images.githubusercontent.com/16078332/101730862-bc91c380-3af5-11eb-82a0-1d3f4e75481d.gif)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuehaipan%2Fdev-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxuehaipan%2Fdev-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuehaipan%2Fdev-setup/lists"}