Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to install bedtools (i.e., a c++ source code for manipulating certain types of files). In order to install it the installation instructions says to download the tar file, untar the file, go to the directory of the untar files, and then type make.

The installation instructions are as follows:

curl http://bedtools.googlecode.com/files/BEDTools.<version>.tar.gz > BEDTools.tar.gz
tar -zxvf BEDTools.tar.gz
cd BEDTools
make clean
make all
sudo cp bin/* /usr/local/bin/

But how can I give it a prefix so I can install it in a specific directory?

I know I could google and try to come up with an answer but since I am installing software I prefer to ask and make sure I am running it right without risking not knowing where I installed it, etc.

I tried make --prefix but prefix is not an option. I am used to using configure, make, make install but this software says to be installed only with make.

Thanks!

share|improve this question

migrated from stackoverflow.com Dec 7 '12 at 7:51

This question came from our site for professional and enthusiast programmers.

    
can you provide a link to their instructions and/or the tar file? –  Karthik T Dec 7 '12 at 3:48
    
@Karthik code.google.com/p/bedtools/downloads/list –  Dnaiel Dec 7 '12 at 3:50
    
Ask on the mailing list or forum of that particular project, or study its Makefile –  Basile Starynkevitch Dec 7 '12 at 7:46
add comment

3 Answers

up vote 1 down vote accepted

The last part of the installation process is to copy the binaries to a location that is in your shell's search path. You can find out about the search path by typing echo $PATH. For me it's:

$ echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin

This means, that when I type a program name into the shell, it will first look in /opt/local/bin if the command can be found there, afterwards in /opt/local/sbin, etc. If I wanted it to look in my home folder I would issue the following command:

PATH=$PATH:~/bin # search my personal bin folder last

or

PATH=~/bin:$PATH # search my personal bin folder first

This change will go away as soon as I log out of the shell. To fix that, I need to add the command to a script that is executed on log in (this might be OS dependent). For me (on Mac OS X) it's the (hidden) .profile file in my home folder, where I add the following line:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH:~/bin

The $PATH is important to keep the important search paths around, that have already been set. If you accidentally delete that part, you have to give the absolute path to your commands: like /bin/ls, /usr/bin/vim, ...

You can find out about which command is being executed by typing which <cmd> into your shell.

share|improve this answer
add comment

The line

sudo cp bin/* /usr/local/bin

is installing the compiled binaries into /usr/local/bin. If you want to install them someplace else, simply change the destination folder in this statement. For example if you want to put them in a bin folder in your home directory it would be

cp bin/* ~/bin

(You can omit the sudo part if you are installing to someplace you already have write access to.)

share|improve this answer
    
thanks! I do not have access to /usr/local/bin nor permission to write there nor sudo but if installs in bin is good, will be in my own dir. –  Dnaiel Dec 7 '12 at 3:57
    
@Ken i said is good –  Dnaiel Dec 7 '12 at 4:05
add comment

It depends upon the particular project.

For many GNU programs, you can change the destination by passing --prefix at configure time.

And several Makefile-s are written so you could

  make install DESTDIR='/tmp/somedestdir'

(but this might not work if the binary has some path hardcoded in it)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.