更新 mac 上的 $PATH 以使用文件的新版本

Updating $PATH on mac to use new version of a file

我原来安装的是elm-format的Elm v0.16版本https://github.com/avh4/elm-format。我不记得我是如何设置它的,但是新的 Elm v0.17 已经发布并且更新了 elm-format。我下载了新的 elm-format 文件,但是当我在终端中输入 elm-format 时,它仍然显示旧版本: elm-format 0.2.0-alpha.

我以为我把它添加到了我的路径中,但我不确定,因为当我 运行 echo $PATH:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

如何才能在 运行 elm-format 时使用我刚刚下载的最新版本?我已经将以前版本的 elm-format 配置为也可以使用 sublime text 但现在我无法更新 sublime 以使用新的 elm-format 并且它默认使用旧版本的 elm-format,导致语法不正确.

此外,由于最新版本的 Elm 具有新的语法和习语,在 sublime 中编写代码时,它仍在尝试使用旧语法,并使用粉红色错误语法高亮突出显示我的 Elm 0.17 语法。

我什至找不到旧版本的 elm-format 在哪里或如何存在,但出于某种原因它是默认版本。

我不知道它是否相关,但这是我当前的 .bash_profile,我显然从未改变它以使用旧版本的 elm 格式:

# STYLING & COLORS
# ################


## LSCOLORS
#> http://osxdaily.com/2012/02/21/add-color-to-the-terminal-in-mac-os-x/
#> http://apple.stackexchange.com/questions/100297/changing-terminal-color

export CLICOLOR=1
export GREP_OPTIONS='--color=auto'
export LSCOLORS=exBxhxDxfxhxhxhxhxcxcx


## Prompt Style/Colors
#> http://blog.taylormcgann.com/2012/06/13/customize-your-shell-command-prompt/
#> http://www.kirsle.net/wizards/ps1.html

export PS1_OLD=$PS1
export PS1="\[3[1;35m\]\W \[3[1;91m\]♥\[3[0;36m\] "

在 Sublime 中,在 Preferences > Package Settings > Elm Language Support > User Settings 我有:

{
    "elm_format_on_save": true,
    "elm_paths": "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/elm-format"
}

总而言之,我完全感到困惑和沮丧,因为我什至无法编写没有粉红色亮点的代码。

首先运行which elm_format显示旧0.16版本的位置。然后,您可以用从 github 获得的新二进制文件替换该二进制文件。从 sublime 路径看,您似乎已将 elm_format 的二进制文件放在硬盘驱动器的根目录下。你可能想把它放在 /usr/local/bin

里面