You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**主要原因: **fish 环境下无法识别 nvm shell 命令,比如 Gihub issues:NVM in fish:
May I request that this issue be reformatted in the form of a bug?
…
NVM does not install if you use the fish shell.
NVM does not work in the fish shell shell shell if previously installed in the bash shell. In fact, nvm > isn’t even in the path.
I also wrote a general wrapper to bring almost any bash utility to fish shell: https://github.com/edc/bass. It works flawlessly with nvm using syntax like bass source ~/.nvm/nvm.sh ; nvm --version. For convenience, one can create an alias Fish function:
functionnvm
bass source~/.nvm/nvm.sh ';' nvm $argv
end
# and then just use nvm --version, nvm ls, etc.
动手实践
第一步 下载 oh-my-fish
Oh My Fish provides core infrastructure to allow you to install packages which extend or modify the look of your shell. It’s fast, extensible and easy to use.
默认设置安装:
curl -L https://get.oh-my.fish | fish
检测:
omf -v
Oh My Fish version 7
或者可以自定义安装:
curl -L https://get.oh-my.fish > install
fish install --path=~/.local/share/omf --config=~/.config/omf
关于使用 curl,这里可能会报错:
Failed to connect to raw.githubusercontent.com port 443: Connection refused
官网介绍:Bass makes it easy to use utilities written for Bash in fish shell.
下载好 oh-my-fish,直接下载 bass:
omf install bass
当然,也可以使用官网提到的 fisher、Fundle 等包管理器。
第三步 配置 nvm
前提是你已经下载好了 nvm,比如我使用 Homebrew 安装:
brew install nvm
然后,安装完成会有一堆提示,如一下关键信息:
You should create NVM's working directory if it doesn't exist:
mkdir ~/.nvm
Add the following to ~/.config/fish/config.fish or your desired shell
configuration file:
export NVM_DIR="$HOME/.nvm"
[ -s"/usr/local/opt/nvm/nvm.sh" ] &&."/usr/local/opt/nvm/nvm.sh"# This loads nvm
[ -s"/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] &&."/usr/local/opt/nvm/etc/bash_completion.d/nvm"# This loads nvm bash_completion
You can set$NVM_DIR to any location, but leaving it unchanged from
/usr/local/opt/nvm will destroy any nvm-installed Node installations
upon upgrade/reinstall.
根据提示进入如下目录,并创建 config.fish 文件:
cd~/.config/fish/
touch config.fish
config.fish添加如下配置:
functionnvm
bass source /opt/homebrew/opt/nvm/nvm.sh ';' nvm $argv
end
激活配置:
source~/.config/fish/config.fish
最后检测:
nvm --version
0.35.3
如果你是全局安装 nvm,比如使用 curl 或者 wget,config.fish应该是:
functionnvm
bass source~/.nvm/nvm.sh ';' nvm $argv
end
主要是 nvm.sh 文件的路径问题是否存在!
大功告成,打完收工!
Fish 中使用 brew
**主要原因: **fish 环境下无法识别 brew shell 命令。
根据提示进入如下目录,并创建 config.fish 文件:
cd~/.config/fish/
touch config.fish
config.fish添加如下配置:
functionbrew
/opt/homebrew/bin/brew $argv
end
激活配置:
source~/.config/fish/config.fish
iterm2新开tab为fish shell
The text was updated successfully, but these errors were encountered:
Mac Fish使用
安装 fish
修改
/etc/shells
文件添加
/usr/local/bin/fish
【我的文件,包含zsh、fish】
修改默认的shell
Fish 配置主题
Fish 中使用 nvm
问题描述: nvm 主要用于 Node 版本控制,macOS 系统下,在 zsh 或 bash 终端,使用 Homebrew 下载,一般都能正常使用,但是切换到 fish 终端就会无法找到此命令。
**主要原因: **fish 环境下无法识别 nvm shell 命令,比如 Gihub issues:NVM in fish:
解决办法
在刚刚 Github Issues 下就有解决方案:
动手实践
第一步 下载 oh-my-fish
默认设置安装:
curl -L https://get.oh-my.fish | fish
检测:
或者可以自定义安装:
关于使用 curl,这里可能会报错:
说得也很明白,就是请求被拒绝访问,那我们怎么办?问度娘!咔咔咔,一段萌操作…之后:
访问ipaddress.com,获取
raw.githubusercontent.com
域名真实 IP,然后在本地 hosts 文件添加即可:添加如下内容,并保存退出:
第二步 下载 Bass
官网介绍:Bass makes it easy to use utilities written for Bash in fish shell.
下载好 oh-my-fish,直接下载 bass:
当然,也可以使用官网提到的 fisher、Fundle 等包管理器。
第三步 配置 nvm
前提是你已经下载好了 nvm,比如我使用 Homebrew 安装:
然后,安装完成会有一堆提示,如一下关键信息:
根据提示进入如下目录,并创建 config.fish 文件:
config.fish添加如下配置:
激活配置:
最后检测:
如果你是全局安装 nvm,比如使用 curl 或者 wget,config.fish应该是:
主要是 nvm.sh 文件的路径问题是否存在!
大功告成,打完收工!
Fish 中使用 brew
**主要原因: **fish 环境下无法识别 brew shell 命令。
根据提示进入如下目录,并创建 config.fish 文件:
config.fish添加如下配置:
激活配置:
iterm2新开tab为
fish shell
The text was updated successfully, but these errors were encountered: