Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently installed Apache Maven on Mac OS X.

apache-maven-3.0.4-bin.tar.gz

I gunzipped this file to /Users/Downloads/apache-maven-3.0.4.

Then, I updated my $PATH to include /Users/Downloads/apache-maven-3.0.4./bin.

Is this acceptable, or is there a standard place to put external binaries?

Thanks.

share|improve this question
up vote 3 down vote accepted

Adding a bin directory to your $PATH is quite acceptable. External 3rd party binaries should be placed in /opt directory. Filesystem hierarchy should be followed & consistant.

/opt/<provider or package>/bin

Maven's documentation encourages installation under /usr/local/apache-maven/<package>. This is also a common practice, but I found updating $PATH can be an unnecessary headache with package version updates & rollbacks. Instead, I'll place each package under /opt, and create a symbolic link to /usr/local/maven. At which point, I'd update $PATH to /usr/loca/maven/bin and update the link as needed.

How I'd install Maven

  • Extract downloaded package to /opt directory
    • cd /opt
    • tar zvxf ~/Downloads/apache-maven-3.0.4-bin.tar.gz
  • Create symbolic link
    • ln -s /opt/apache-maven-3.0.4 /usr/local/maven
  • Update $PATH
    • echo "export $PATH=/usr/local/maven/bin:$PATH" >> ~/.profile
    • source ~/.bash_profile

If and when a new version comes along

Repeat the above steps; except, remove old link first.

  • Remove old link
    • rm /usr/local/maven
  • Recreate link to new version
    • ln -s /opt/apache-maven-3.0.5 /usr/local/maven
share|improve this answer
    
Thank you. Very clear answer. – Kevin Meredith Aug 9 '12 at 3:01
    
Let me make sure I understand. So you just copy the bin directory of a folder to /opt, but then you'll also have a duplicate copy under /usr/local/maven/bin, and update your $PATH to /usr/local/maven/bin? – Kevin Meredith Aug 9 '12 at 12:41
1  
Copy maven in it's entirety to opt. So you'll have /opt/apache-maven-3.0.4. I'll update the answer to include steps I'd follow. – emcconville Aug 9 '12 at 12:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .