1

I am a very new beginner in bash programming and never succeed in installing tools on my computer.

I am trying to install bedtools without any success

I typed these following commands on my terminal

wget https://github.com/arq5x/bedtools2/releases/download/v2.29.1/bedtools-2.29.1.tar.gz
tar -zxvf bedtools-2.29.1.tar.gz
cd bedtools2
make

It seems everything is good at these steps and then in order to add it on my path I typed:

echo 'export PATH="$PATH:/Users/avitrac/my_bin/bedtools2"' >> ~/.bash_profile

but when I am testing some basic command such as bedtools -h it says bedtools command is not found.

I feel there is something wrong with the echo step or with my bash_profil. I tried to follow instruction that I have read on internet but I feel I may did some mistakes.

Could someone help me ? I don't understand what is wrong and how to fix it !

  • After `make`, did you type any other commands before the `echo ...` command? The instructions say to "...copy the binaries in ./bin/ to either usr/local/bin/..." so if you did that, please [edit] your question to indicate what they were. Thank you! – Jeff Schaller Mar 05 '22 at 16:48
  • Actually I did not understand this step, and I thought that making all these command in Users/avitrac/my_bin/ allowed me to skip this step. So I don't understand what I am suppose to do in this step as I was already in my my_bin folder. – Aurelia Kurtis Mar 05 '22 at 16:53
  • The build procedure leaved the binary files in `./bin`. The installation instructions are telling you to copy those binaries to whatever you want them to be (and point `$PATH` to that location, if not already there). It looks like you want your binaries to be in `/Users/avitrac/my_bin/bedtools2` (because this is what you are adding to `$PATH`, so copy the built binaries to that location. – Poshi Mar 05 '22 at 17:09

1 Answers1

1

It looks like you accidentally downloaded and compiled the program under your my_bin directory. That creates some potential for confusion, so I would recommend running the wget and make commands from a temporary directory, such as /tmp or a tmp directory under your home directory. As a result, the compiled binaries are now under /Users/avitrac/my_bin/bedtools2/bin. I would recommend moving that directory outside of your my_bin directory, perhaps to a ~/tmp directory; you could then skip directly to step 5 below.

(You could leave it there and simply cp /Users/avitrac/my_bin/bedtools2/bin/bedtools ~/my_bin, but that would leave the source code and compilation artifacts under your bin directory for no good reason).

  1. mkdir ~/tmp ## if needed
  2. cd ~/tmp
  3. wget https://github.com/arq5x/bedtools2/releases/download/v2.29.1/bedtools-2.29.1.tar.gz
  4. make
  5. cp bin/bedtools ~/my_bin/

The bedtools-2.29.1.tar.gz file and bedtools2 directory can both be removed now. The "Compiling from source via Github" instructions gloss over this (fairly typical) use-case and omitted the explicit instructions to build the program in a temporary location.

Jeff Schaller
  • 2,352
  • 5
  • 23
  • 38
  • thank you for your response. I also did that before and it was not working too... I tried several times the echo step with different things. In results when I type: echo $PATH | tr ":" "\n" I have many directories inside including this one Users/avitrac/my_bin. And other thing that I did not mention, I was in the my_bin directory when I type the previous command of my post – Aurelia Kurtis Mar 05 '22 at 16:21
  • Did you intentionally change the name of the program to `bedtools2`? The documentation indicates that the program is usually invoked as `bedtools` (no `2`). You could try invoking `bedtools2` or rename it with `mv bedtools2 bedtools`. – Jeff Schaller Mar 05 '22 at 16:29
  • The program is indeed bedtools but the command to install it as it is indicated in the link you sent to me used bedtools2 as name. I used exactly the same command than the one indicated on the link. I don't understand how rename the name of the program because actually, I am not sure of what file it is. (I have several files and folders in the bedtools2 folder that I got after unzip it with tar (I am so sorry, as I said, I am a very beginner in bash..). I tried to invoke it as bedtools and bedtools 2 and none of the two worked (command not found for both). – Aurelia Kurtis Mar 05 '22 at 16:42
  • Another point that may be not clear: in this path /Users/avitrac/my_bin/bedtools2, bedtools2 is the folder that I got after the tar command. I did the make command inside this folder as recommended in the link that you have sent. So in this path, bedtools refers to the folder and not the program that I don't know to which file it corresponds – Aurelia Kurtis Mar 05 '22 at 16:47
  • Ahhhh; these would be excellent [edit]s to your question, please & thank you! – Jeff Schaller Mar 05 '22 at 16:51
  • I've updated my answer in view of your new comments. Thank you for clarifying what you did! – Jeff Schaller Mar 05 '22 at 17:07
  • 1
    thanks a lot for helping me to understand this procedure ! I totally misunderstood the last step and I thought that making everything in my bin would be easier. Following your super clear instruction I finally succeed to install my first tool. – Aurelia Kurtis Mar 05 '22 at 17:23
  • Happy to hear! Hopefully you can apply this general idea to any future programs that you find yourself installing from source! – Jeff Schaller Mar 05 '22 at 17:36