how to use fzf on Mac Terminal with bash

I suggest that you read through the README page. You need a basic level of understanding of shell scripting in order to fully utilize fzf.

fzf is a Unix filter just like grep or sed, and all it does is to print the selected items. What to do with the output is completely up to you.


1) After I run fzf and run a file, I press Enter and then the file I found is output in Terminal. Instead of Enter, what key should I press to copy that file path to my pastebin?

You can use pbcopy command to store the result in clipboard like so:

fzf | pbcopy

More conventional way to use fzf is to use it with command substitution:

cat $(fzf)

Or to use the CTRL-T key binding that pastes the names of the selected files onto the command line:

cat <CTRL-T>

2) Ideally, I'd like to be able to do something like this: cat where I type part of the name of a file and then press a hotkey to start an fzf search for that pattern. Is there a way to do this?

fzf is shipped with fuzzy-completion for bash. See here for more details. To invoke auto-completion, append two asterisks to the pattern and hit the tab key as follows:

cat pat**<Tab>

If you don't use bash, the closest you can do is to use CTRL-T keybinding mentioned above.

See: https://github.com/junegunn/fzf#key-bindings-for-command-line


I tried installing fzf via homebrew and my CTRL-T and pat** shortcuts also did not work. I found that fzf added some commands to my .bashrc, but my .bashrc doesn't get called.

[ -f ~/.fzf.bash ] && source ~/.fzf.bash

Putting that same source statement from .bashrc into .bash_aliases did the trick for me.