Why does homebrew link to ../Cellar and not /usr/local/Cellar? - macos

I have:
MacOS 10.12.2
homebrew 1.1.5
maven 2.0.8
I am trying to install maven 3
before running brew, which mvn reports /usr/local/apache-maven-2.0.8/bin/mvn as we would expect.
after running brew install maven without errors which mvn now reports ../Cellar/maven/3.3.9/bin/mvn and mvn -v still reports 2.0.8.
I'm new to brew. brew doctor does not report any errors. What am I doing wrong?

Because users might install Homebrew in a different path (e.g. ~/.homebrew). In order to support any install path Homebrew uses relative paths when symlinking binaries and other files.
after running brew install maven without errors which mvn now reports ../Cellar/maven/3.3.9/bin/mvn and mvn -v still reports 2.0.8.
This is a different issue; this time due to your shell which checks the full path of an executable only the first time you use it. That is, the first time you typed mvn -v it did the equivalent of which mvn and remembered that path. The second time you typed mvn -v it used that path instead of re-checking it. Type hash -r to reset its memory or start a new shell.

Related

Zombie mvn: Maven uninstall troubles

I am currently struggling with an uninstalled maven 3.3.9 on my Ubuntu 16.04, which I uninstalled using the command
sudo apt-get remove --auto-remove maven
I have installed maven 3.6.1 in my local directory,
and command which mvn points exactly to the executable,
but when I'm trying to execute the command mvn --version it shows File not found (at the old /usr/bin path of the uninstalled 3.3.9 version)
bash: /usr/bin/mvn: File not found
So, obviously, there is some symbolic link or something else, but trying to find the broken link with the command
find . -type l | xargs file | grep broken from /
does not come up with any mvn link.
That's rather annoying, can please someone give me an idea how to get rid of the zombie mvn?

Can't find maven in OS X Yosemite 10.10.4

Nothing when I type:
$ whereis mvn
but I guess it is somewhere because from Eclipse I can select a pom.xml file and run it as maven build
As pointed out in the comments, Eclipse brings its own bundled Maven. If you want to use Maven on the shell, I suggest you install Homebrew and then install Maven like this:
brew install maven
After that you should be able to use mvn on the command line.
By the way, to find out where mvn is, use:
which mvn

How to find out what version of maven I am using

The following command in my terminal is not working (mac user)
mvn --version
I want to find out what version of maven I have. I know that I have maven because I use it all the time but I am wondering my this command is not working.
For mac user follow the below link:
http://coolestguidesontheplanet.com/installing-homebrew-os-x-yosemite-10-10-package-manager-unix-apps/
then after you follow those directions enter
brew install maven

Upgrading Maven on Mac

Tried to upgrade maven. Followed this tutorial. Now I am getting this
How does a file exist and not exist?
To upgrade to the latest version (if you have one already installed but need to update the version) do the following:
1. brew update
2. brew unlink maven
3. brew install maven
if you then execute the mvn --version command you should see that your version of maven has been upgraded.
EDIT:
If you have an issue with the update (command 1) that goes along the lines of
error: The following untracked working tree files would be overwritten by merge:
Library/Formula/... try this answer from another issue
You created a symbolic link from your Downloads directory with a directory that may not exist anymore (or with an incorrect path). The directory /usr/bin/mvn obviously exists but the link is incorrect to the target which leads to the "No such file or directory" error when typing mvm --version.
Go through the tutorial again (which seems ok) but if you fail you could always try using Homebrew with the following commands :
brew update
brew install maven
if you installed maven in your mac, i use the next command...
>brew upgrade maven
screenshot
I will be fixed if you run below commands
brew update
brew install maven
Still issue is exist check your M2_HOME path.
It should set to
M2_HOME=/usr/local/bin/mvn

Perl & CPAN upgrade help for OS X

Here is my problem. I am running OS X v10.7 (Lion) and want to set up an old Perl program I have written (was then using a Windows System with ActivePerl and then its ppm).
I read to use CPAN to install Perl modules (I am trying to install the Graph module). Whenever I tried to install it, it failed from a refused connection. Why? So I read that I should run the following to update CPAN and fix any broken links:
cpan> install Bundle:CPAN
cpan> reload cpan
cpan> index cpan
cpan> exit
However, after doing this I am stuck with this every time I try to do a CPAN install or upgrade:
New CPAN.pm version (v1.9800) available.
[Currently running version is v1.9456]
You might want to try
install CPAN
reload cpan
to both upgrade CPAN.pm and run the new version without leaving
the current session.
I was trying to use the default Perl stuff that is included in OS X rather than downloading ActivePerl. How do I fix CPAN and install the Graph Module?
PS: Running install CPAN and reload CPAN didn't do anything, but it generated the same message.
UPDATE
I was able to upgrade to v1.9800 doing a manual install (make, install) through the terminal. But I am still unable to install the Graph Module. Here is what I am getting:
http://cloud.jjnford.com/3D1C1H4217222b1p1O3a
UPDATE - PROBLEM SOLVED
I was finally able to solve the problem. I just moved the /User/jj/.cpan directory to User/jj/.cpan_bak and then reconfigured CPAN and the Graph Module installed with no fuss.
To solve this problem, do a manual upgrade of CPAN (apparently on OS X CPAN has trouble upgrading itself). You can download the source from here. After you have downloaded it uncompress it, create the make file from the Perl script, then run a make test, and finally if all goes well a make install.
$> tar -xvxf CPAN-1.9800
$> cd CPAN-1.9800
$> perl Makefile.PL
$> make
$> make test
$> make install
Now get rid of your old CPAN configuration:
$> mv ~/.cpan ~/.cpan.bak
Now when you run CPAN from the terminal you should be prompted for the configuration again. Once this is complete and CPAN has started you will notice this:
cpan shell -- CPAN exploration and modules installation (v1.9800)
So CPAN is now upgraded and working, and in my case I installed the Graph Module:
$cpan> install Graph
And everything works fine. I hope this helps somebody.
I have a fresh Mac OS X Lion and I updated CPAN without problems.
Installing XCode is not enough. Make, gcc, g++ are not installed by default.
To install them, one has to:
Start XCode, go to XCode->Preferences->Downloads and install component named "Command Line Tools".
I know this was solved, but do consider using "cpanminus" instead next time. It's faster and could save you a lot of hassle. You can either install App:cpanminus using cpanminus (see: App::cpanminus):
curl -L http://cpanmin.us | perl - --sudo App::cpanminus
And then to install any module and its dependencies simply run:
cpanm <module>
Alternatively you could use it directly from the web:
curl -L http://cpanmin.us | perl - --sudo <module>
I use it on my OS X Lion, and it works perfectly :)
Please excuse me for replying to this old post.
I had the same issue as the OP. Once I corrected the command to contain two colons instead of one (i.e. - Bundle::CPAN vs Bundle:CPAN), it worked as expected.

Resources