开发环境配置

windows环境

scoop

scoop是一个命令行安装wget、python、java、miniconda等的一个工具。可以切换不同版本。scoop在国内参考下列方式更快

第一步:一健安装

Set-ExecutionPolicy RemoteSigned -scope CurrentUser
iwr -useb https://gitee.com/RubyKids/scoop-cn/raw/master/install.ps1 | iex

第二步:换到更快的国内源

上述运行完毕就可以执行scoop命令了。为了加快安装速度,推荐切换一下源:

scoop bucket rm main
scoop bucket add main https://gitee.com/townsin/Scoop.git
scoop bucket add versions # 可以支持多版本切换,例如python
scoop bucket add rsync https://github.com/rivy/scoop.bucket.scoop-main.git # 支持rsync等工具

至此安装完毕。如果bucket的地址觉得慢,可以到国内比如gitee上clone一份,用gitee的地址,不过很多人已经clone过来了,gitee会提示相同的clone,用其他人clone好的gitee仓库地址就行了。

cygwin

cygwin可以愉快地在win下使用命令行。然后cygwin自带的sshd可以作为服务运行,实现windows远程shell访问。服务环境更统一,避免win自带的那个openssh的很多坑。

  1. 到https://www.cygwin.com/ 下载安装包

  2. 在你的电脑新建一个目录,这个目录我用 CYG_HOME代替。把下好的setup-x86_64.exe放到这个目录里。

  3. 打开setup-x86_64.exe进行安装,缓存目录选CYG_HOME/_pkgcache/,没有就新建。下载镜像地址选国内的163.com。注意几个组件选上: wget,rsync,sshd

  4. 一直点下一步,等安装完毕,吧CYG_HOME/bin, CYG_HOME/usr/sbin加入win的环境变量path里,这样在普通win命令行也能用cygwin的命令。

  5. 这一步安装apt-cyg, 是一个cygwin里在命令行就可以安装组件的神器,要不然每次还要再点开setup-x86_64.exe很麻烦(虽然他也可以命令行,但是命令比较长),对于有洁癖的人也总感觉形式上不统一。apt-cyg就好比ubuntu里的apt-get 命令。精彩讨论请看stackoverflow

# 首先进入cygwin
wget https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg
chmod +x apt-cyg
mv apt-cyg /usr/local/bin
  1. 此时安装完毕,接下来开启sshd 服务。
ssh-host-config
net start cygsshd # 如果不行就到windows服务里看看手工启动
  1. 开启22端口。参考这篇文章 https://www.ittsystems.com/create-sftp-server-using-cygwin/#wbounce-modal

  2. 最后说一下,sftp也能用了。

  3. 设置cygwin为默认的shell,也就是ssh登录windows后默认为cygwin环境。

New-ItemProperty -Path "HKLM:\\SOFTWARE\\OpenSSH" -Name DefaultShell -Value "C:\\cygwin64\bin\sh" -PropertyType String -Force

这个我试了试,不成功,后来也懒得折腾了。

mac os 配置

home brew

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

# 替换brew.git 切换到国内加快速度
cd "$(brew --repo)"
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git

# 替换homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git

# 刷新源
brew update

参考这篇文章 https://zhuanlan.zhihu.com/p/111014448

软件

  • chrome
  • wx
  • goland
  • pycharm
  • microsoft rdp
  • world、Excel、PPT

终端配置

mac默认的终端是黑白的,为了达到Linux一样的彩色:在 ~/.bash_profile中加入 如下

export CLICOLOR='YES'
export LSCOLORS='ExGxFxdaCxDaDahbadeche'
export GREP_OPTIONS='--color=auto'

这样默认还不会起作用,需要在 ~/.zprofile最后加一句

source ~/.bash_profile
build:   __BUILD_VERSION__