2

I have installed pandoc using homebrew and the Anaconda python distribution using pyenv. I've just found that Anaconda comes with its own pandoc binary and since the pyenv shims come before homebrew in my PATH, I cannot use the homebrew (and newer) version of pandoc.

This is my current PATH

➜ ~ echo $PATH
/Users/marco/.pyenv/shims:/Users/marco/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin
➜ ~ which pandoc
/Users/marco/.pyenv/shims/pandoc

Is there a way to force the terminal to use the homebrew version of a binary without breaking the PATH?

0

You can always provide the full path to the binary instead of using the PATH at all.

$ /usr/local/bin/pandoc

To make multiple executions easier, you can create an alias.

alias pandoc=/usr/local/bin/pandoc
$ which pandoc
/Users/marco/.pyenv/shims/pandoc

$ alias pandoc=/usr/local/bin/pandoc

$ which pandoc
pandoc: aliased to /usr/local/bin/pandoc

To make future executions easier, put this alias in a .profile.

To bypass the alias without removing it, prepend a \.

$ \pandoc

The ‘right way’ is still to modify your PATH.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .