在 macOS Catalina 下使用 Nix 安装/升级 bash

在 macOS Catalina 下使用 Nix 安装/升级 bash

我正在使用 macOSCatalina和 Nix 2.3.12

我正在更新bash到最新版本(通过 Nix)。我可以成功安装它,并且它会加载 Nix 安装的版本,但是如果我尝试使用 Bash 5.x(更新版本)中的任何功能,我将无法使用,除非.bashrc是源代码 — 这又是 Nix 的源代码。

我的来源.bashrc.bash_profile仅包含此内容):

#
# ~/.bash_profile
#

[ -f "${HOME}/.bashrc" ] && . "${HOME}/.bashrc"

有没有办法在所有这些发生之前加载更新版本?

即使我/etc/shells使用新bash位置更新文件并尝试chsh -s /Users/x80486/.nix-profile/bin/bash这样做也不起作用。


.bashrc这是我的文件的内容:

#
# ~/.bashrc
#

# If not running interactively, don't do anything
# -------------------------------------------------------------------------------------------------
[[ $- != *i* ]] && return

# Aliases
# -------------------------------------------------------------------------------------------------
[ -f "${HOME}/.bash_aliases" ] && . "${HOME}/.bash_aliases"

# Check the window size after each command and, if necessary, update the
# values of LINES and COLUMNS
# -------------------------------------------------------------------------------------------------
shopt -s checkwinsize

# Append to the history file, don't overwrite it
# -------------------------------------------------------------------------------------------------
shopt -s histappend

# Prompt customization
# -------------------------------------------------------------------------------------------------
PS1="\[$(tput sgr0)\][\[\033[01;32m\]\u@\h\[$(tput sgr0)\]:\[\033[01;34m\]\w\[$(tput sgr0)\]]$ "
# PS1="[\u@\h \W]$ "
export PS1

# Set default editor
# -------------------------------------------------------------------------------------------------
EDITOR=/usr/bin/nano
export EDITOR

# Set default blocksize for ls, df, du
# -------------------------------------------------------------------------------------------------
BLOCKSIZE=1k
export BLOCKSIZE

# Do not log repeated identical commands
# -------------------------------------------------------------------------------------------------
HISTCONTROL=ignoreboth:erasedups
export HISTCONTROL

# Increase/Set history limit (100 KB or 5000 entries)
# -------------------------------------------------------------------------------------------------
HISTFILESIZE=100000
export HISTFILESIZE
HISTSIZE=100
export HISTSIZE

# Erlang
# -------------------------------------------------------------------------------------------------
# export ERL_AFLAGS="+pc unicode -kernel shell_history enabled"

# Golang
# -------------------------------------------------------------------------------------------------
GOPATH="${HOME}/.cache/go-path"
export GOPATH

[ ! -d "${HOME}/.cache/go-path" ] && mkdir --parents "${HOME}/.cache/go-path"
PATH="${PATH}:${GOPATH}/bin"

# Nix Package Manager
# -------------------------------------------------------------------------------------------------
BASH_COMPLETION_COMPAT_DIR="${HOME}/.nix-profile/etc/bash_completion.d"
export BASH_COMPLETION_COMPAT_DIR
XDG_DATA_DIRS="${HOME}/.nix-profile/share:${XDG_DATA_DIRS}"
export XDG_DATA_DIRS

[ -f "${HOME}/.nix-profile/etc/profile.d/nix.sh" ] && . "${HOME}/.nix-profile/etc/profile.d/nix.sh"
[ -f "${HOME}/.nix-profile/etc/profile.d/bash_completion.sh" ] && . "${HOME}/.nix-profile/etc/profile.d/bash_completion.sh"
[ -f "${HOME}/.nix-profile/etc/bash_completion.d/git-completion.bash" ] && . "${HOME}/.nix-profile/etc/bash_completion.d/git-completion.bash"
[ -f "${HOME}/.nix-profile/share/bash-completion/completions/gradle" ] && . "${HOME}/.nix-profile/share/bash-completion/completions/gradle"

# Playground Area
# -------------------------------------------------------------------------------------------------

# ASDF
# -------------------------------------------------------------------------------------------------
[ -f "${HOME}/.asdf/asdf.sh" ] && . "${HOME}/.asdf/asdf.sh"
[ -f "${HOME}/.asdf/completions/asdf.bash" ] && . "${HOME}/.asdf/completions/asdf.bash"

export PATH

相关内容