autojum和zsh使用MAC

安装oh my zsh环境

1.安装wget http://ftp.gnu.org/gnu/wget/,下载最新版本.

2.解压缩,cd到目录文件夹,依次执行命令

1
2
3
./configure --with-ssl=openssl
make
sudo make install

备注:出现错误

1
checking host system type... configure: error: can not guess host type; you must specify one

执行下面的命令

1
./configure --with-ssl=openssl --host=TARGET

3.自动安装

1
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

或者手动安装

1
2
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

成功后退出页面重新打开终端.

备注:如果没有变化可以执行切换

1
zsh

配置文件在~/.zshrc里面

4.切换shell

用如下命令切换shell:

1
chsh -s /bin/zsh

重启terminal就好啦,应该就成功的从bash切换到zsh了:)

查看当前使用的shell

1
echo $SHELL

如果你想看看自己的机子上装了哪些shell,可以使用如下命令:

1
cat /etc/shells

插件

1.安装autojump执行命令自动安装

1
brew install autojump

或者手动安装

1
wget https://github.com/downloads/joelthelion/autojump/autojump_v21.1.2.tar.gz

解压后进入目录,执行

1
./install.sh

最后把以下代码加入~/.zshrc

1
[[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh

同时追加

1
plugins=(git autojump osx)

使用是

1
j xxx文件夹

2.git plugin 配置快捷配置,

1
source  ~/.oh-my-zsh/plugins/git/git.plugin.zsh

自定义设置

对RN的命名简化,在~/.zshrc里面最后添加

1
2
alias rna="react-native run-android"
alias rni="react-native run-ios"

以后就可以使用rna `rni `运行了

显示隐藏文件的方法

1
2
3
4
5
6
7
#显示全部文件
defaults write com.apple.finder AppleShowAllFiles -bool true
osascript -e 'tell application "Finder" to quit'

#不显示全部文件
defaults write com.apple.finder AppleShowAllFiles -bool false
osascript -e 'tell application "Finder" to quit'

安装ruby

通过Homebrew安装Ruby

1
$ brew install ruby

错误log

1
Users/yangshuo06/.rvm/src/ruby-2.4.1/.ext/x86_64-darwin17/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib (LoadError)

全部删掉重新安装

1
2
3
4
5
brew uninstall ruby

brew uninstall openssl

uninstall_oh_my_zsh //卸载oh_my_zsh

/usr/local/opt 权限问题

1
sudo chown -R `whoami`:admin /usr/local/opt

参考1

参考2

Ruby安装(Mac)