δΈζη π
Automation scripts for setting up a basic development environment. (screenshots)
Download the script file using wget / curl / git or any browser (click here to download zip). Open Terminal
and run:
via wget
# Download and run via wget
/bin/bash -c "$(wget -O - https://github.com/XuehaiPan/Dev-Setup/raw/HEAD/setup.sh)"
via curl
# Download and run via curl
/bin/bash -c "$(curl -fL https://github.com/XuehaiPan/Dev-Setup/raw/HEAD/setup.sh)"
via git or browser
# Download via git
git clone --depth=1 https://github.com/XuehaiPan/Dev-Setup.git
# Run the script file
cd Dev-Setup
/bin/bash setup.sh
Options:
-
SET_MIRRORS
(defaultfalse
): set the source of package managers to open source mirrors at TUNA (@China) to speed up downloading. (see Packages for more details). If you want to bypass the prompt, run:# Bypass the prompt SET_MIRRORS=true bash setup.sh # set mirrors to TUNA (@China) (recommended for users in China) SET_MIRRORS=false bash setup.sh # do not modify mirror settings
Note: If you are using WSL on Windows, you need to run Windows 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 and install them manually. See Font Settings for more details.
After running the script, all the old configuration files involved will be backed up to the folder ${HOME}/.dotfiles/backups/<DATETIME>
, and a symbolic link ${HOME}/.dotfiles/backups/latest
will link to the latest one. You can compare the differences using:
# Compare the differences
colordiff -uEB ~/.dotfiles/backups/latest ~/.dotfiles
colordiff -uEB ~/.dotfiles/backups/latest/.dotfiles ~/.dotfiles
# Ignore miscellaneous directories
colordiff -uEB -x 'backups' -x '.dotfiles' ~/.dotfiles/backups/latest ~/.dotfiles
colordiff -uEB -x 'backups' ~/.dotfiles/backups/latest/.dotfiles ~/.dotfiles
There is a nice way to inspect and move changes from one version to another version of the same file using vimdiff
or meld
. Run:
# Inspect and move changes using vimdiff
vim -c "DirDiff ~/.dotfiles ~/.dotfiles/backups/latest/.dotfiles"
You can get vimdiff reference manual from https://vimhelp.org/diff.txt.html, or type command :help diff
inside Vim.
You can rollback to your previous dotfiles using:
# Rollback to the latest backup in "${HOME}/.dotfiles/backups/latest"
bash restore_dotfiles.sh
# Rollback to a specific version
bash restore_dotfiles.sh "${HOME}/.dotfiles/backups/<DATETIME>"
Note: the packages installed by setup.sh
(see Packages) will remain in your system.
You can upgrade your packages just by running:
upgrade_packages
By 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:
upgrade_packages; upgrade_conda
The 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. You can download any nerd font you like from nerdfonts.com manually. The script will download and install DejaVu Sans Mono Nerd Font
for macOS, Linux and Windows (administrator privilege is required to install fonts on Windows).
Configure your terminal to use nerd fonts:
- For macOS and Linux users, change the terminal font setting to "Nerd Font Complete" (e.g.
'DejaVuSansM Nerd Font Book'
). - For WSL on Windows users, change the terminal font setting to "Nerd Font Complete Windows Compatible" (e.g.
'DejaVuSansMono NF'
).
See Font configurations for Powerlevel10k for more details.
Or use Zsh with Powerlevel10k Lean style:
chsh -s /usr/local/bin/zsh-lean # change the login shell
which do not need additional font settings.
Note: If you are using WSL on Windows, you need to run Windows 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:
find -L ~/.local/share/fonts -not -empty -type f -name '*.tt[fc]' -print0 | xargs -0 -I '{}' bash -c \
'file="{}"
font=${file##*/}
echo "Installing \"${font}\" to \"/mnt/c/Windows/Fonts\""
cp -f "${file}" /mnt/c/Windows/Fonts
/mnt/c/Windows/System32/reg.exe add "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts" \
/v "${font%.tt[fc]} (TrueType)" /t REG_SZ /d "${font}" /f'
Make your own setup scripts. Add a new config file to the script:
- fork this repository;
- copy the contents of your config file to a temp file
temp.txt
; - replace all identifiers of your home directory with
${HOME}
intemp.txt
; - replace all identifiers of your user name with
${USER}
intemp.txt
; - replace all
\
with\\
intemp.txt
; - replace all
$
with\$
intemp.txt
; - add the following lines to script
setup_<OS_NAME>.sh
:
cd "${HOME}" # this line has already been added at the top of the script
# Replace <CFG_FILE> with the config file's name
backup_dotfiles <CFG_FILE> .dotfiles/<CFG_FILE>
cat >.dotfiles/<CFG_FILE> <<EOF
# Paste the contents in the temp file `temp.txt` here
EOF
ln -sf .dotfiles/<CFG_FILE> .
- add
<CFG_FILE>
and.dotfiles/<CFG_FILE>
toDOTFILES
inrestore_dotfiles.sh
.
The 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).
The following packages will be setup:
Package | macOS | Ubuntu Linux | Manjaro Linux |
---|---|---|---|
Mirrors at TUNA (@China) | β | β | β |
Homebrew | β | β | β |
bash | β | β | β |
bash-completion | β | β | β |
zsh & oh-my-zsh | β | β | β |
powerlevel10k | β | β | β |
zsh-syntax-highlighting | β | β | β |
zsh-autosuggestions | β | β | β |
zsh-completions | β | β | β |
colorls | β | β | β |
git & git-lfs | β | β | β |
vim & vim-plug | β | β | β |
tmux & oh-my-tmux | β | β | β |
reattach-to-user-namespace / xclip | β | β | β |
fzf | β | β | β |
ranger | β | β | β |
fd | β | β | β |
bat | β | β | β |
highlight | β | β | β |
ripgrep | β | β | β |
wget | β | β | β |
curl | β | β | β |
openssh | β | β | β |
ruby & rubygems | β | β | β |
perl & cpan | β | β | β |
htop | β | β | β |
net-tools | β | β | β |
atool | β | β | β |
tree | β | β | β |
git-extras | β | β | β |
diffutils | β | β | β |
colordiff | β | β | β |
diff-so-fancy | β | β | β |
jq | β | β | β |
shfmt | β | β | β |
shellcheck | β | β | β |
Miniconda3 | β | β | β |
mamba | β | β | β |
gcc | β | β | β |
gdb | β | β | β |
clang & llvm | β | β | β |
lldb | β | β | β |
make | β | β | β |
cmake | β | β | β |
automake | β | β | β |
autoconf | β | β | β |
DejaVu Sans Mono Nerd Font | β | β | β |
Cascadia Code Font | β | β | β |
Menlo Font | β | β | β |
Microsoft YaHei Mono Font | β | β | β |
Currently macOS only casks installed by Homebrew:
Package | Description | macOS | Ubuntu / Manjaro Linux |
---|---|---|---|
iTerm2 | A terminal emulator for macOS that does amazing things | β | β |
Google Chrome | A fast, secure, and free web browser built for the modern web | β | β |
Keka | The macOS file archiver | β | β |
IINA | The modern media player for macOS | β | β |
Typora | A truly minimal markdown editor | β | β |
Visual Studio Code | A lightweight but powerful source code editor | β | β |
XQuartz | An open-source effort to develop a version of the X.Org X Window System that runs on macOS | β | β |
Shell:
tmux:
fzf:
Vim:
Live markdown preview support for Vim: