Ripgrep: RIPGREP_CONFIG_PATH doesn't work with symlinked file

Created on 19 Feb 2018  路  5Comments  路  Source: BurntSushi/ripgrep

What version of ripgrep are you using?

ripgrep 0.8.0 (rev )
-SIMD -AVX

What operating system are you using ripgrep on?

macOS 10.13.3

Describe your question, feature request, or bug.

ripgrep does not appear to be able to follow symlinks for a config file.

If this is a bug, what are the steps to reproduce the behavior?

  • Create a ripgrep config file, rgrc, for example
  • symlink it into your home directory
  • set export $RIPGREP_CONFIG_PATH="$HOME/.rgrc"
  • reload terminal

If this is a bug, what is the actual behavior?

With export $RIPGREP_CONFIG_PATH="$HOME/.rgrc" set in my ~/.zshrc, I get the following error when opening a new terminal:

/Users/nicknisi/.zshrc:58: /Users/nicknisi/.rgrc not found

This file does exist, but it is a symlink.

If this is a bug, what is the expected behavior?

I would expect ripgrep to be able to find the symlinked config file

invalid

Most helpful comment

I'd also like to add the related issue that I experienced, which is equally silly on my part (if not more so).

When you add your environment variable, make sure that you do in fact use export, or else the variable will not be inherited by child processes:

# add a config file for ripgrep
-RIPGREP_CONFIG_PATH="$HOME/.rgrc"
+export RIPGREP_CONFIG_PATH="$HOME/.rgrc"

Again, unrelated to the ripgrep utility itself, but maybe useful for others who find this page when Googling.

All 5 comments

Sorry, this doesn't appear to be a ripgrep issue.

@nicknisi Could you say what the issue was? It might help others.

This just turned out to be silliness on my part when exporting the RIPGREP_CONFIG_PATH variable.

 # add a config file for ripgrep
-export $RIPGREP_CONFIG_PATH="$HOME/.rgrc"
+export RIPGREP_CONFIG_PATH="$HOME/.rgrc"

@nicknisi Ah yeah, I've been there! :) Thanks for sharing!

I'd also like to add the related issue that I experienced, which is equally silly on my part (if not more so).

When you add your environment variable, make sure that you do in fact use export, or else the variable will not be inherited by child processes:

# add a config file for ripgrep
-RIPGREP_CONFIG_PATH="$HOME/.rgrc"
+export RIPGREP_CONFIG_PATH="$HOME/.rgrc"

Again, unrelated to the ripgrep utility itself, but maybe useful for others who find this page when Googling.

Was this page helpful?
0 / 5 - 0 ratings