Administrator – Adding Binary to ~/.local/bin

administratorbinary

In short, I have a working executable in my home directory. I want to make the executable available in the Terminal for the current user in any directory.

More context: The executable is geckodriver. The book I am using, Test-Driven Development with Python by Harry J.W. Percival, says "For macOS or Linux users, one convenient place to put [Geckodriver] is ~/.local/bin"

Based on this suggestion, I thought I should do something like mv geckodriver ~/.local/bin. Turns out ~/.local/bin is an executable, not a directory on my machine. This is keeping me from simply creating a bin directory in ~/.local.

I think there is something fundamental I do not understand here. Any clues?

Best Answer

What you did was move the geckodriver executable into ~/.local, and rename it to bin. The directory must exist first before mv can move anything into it, or it will assume you intend to rename the file at the destination. You can either delete ~/.local/bin with rm ~/.local/bin and make the directory with mkdir ~/.local/bin, then redownload it, or you can run the command mv ~/.local/bin ~/.local/geckodriver && mkdir ~/.local/bin && mv ~/.local/geckodriver ~/.local/bin, so you don't have to redownload it.