1

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.

1 Answer 1

3

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
2
  • 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? Aug 9, 2012 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. Aug 9, 2012 at 12:59

You must log in to answer this question.

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