Upgrading Maven on Mac - macos

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

Related

install maven 3.6.0 on Mac

I am trying to install a specific version of man.brew install maven#3.6.0 is not working due to lack of 3.6 version (there is 3.5, 3.2, 3.3). installation with this guide https://maven.apache.org/install.html also not.
zsh: man not found
Any ideas?
You can use Maven Version Manager to manage multiple versions of maven. You can have a folder-specific maven version.
Steps
If you already installed the maven brew formula uninstall it brew remove --force maven
Install mvnvm. brew install mvnvm
To set the global maven version add an environment variable named DEFAULT_MVN_VERSION with the maven version you want as default as the value.
To set a Maven version for a specific folder create a file named mvnvm.properties in that folder and have the following content.
mvn_version=<maven version for the folder>
You can get the 3.6.3 binaries from here
https://dlcdn.apache.org/maven/maven-3/3.6.3/
Just saw and struggled for a bit before getting to the wget command

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

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.

Building XDebug For Use by MAMP?

I'm using MAMP on Mac OSX Mavericks. I'd like to install the latest XDebug, v2.2.4. Per the XDebug Wizard, I downloaded the XDebug 2.2.4 source. I have many versions of phpize installed on my system - one that is in /usr/bin/, and many others that come with MAMP. MAMP supplies the required phpize for each version of PHP it includes.
Seeking to use the correct phpize, per the XDebug Wizard instructions - http://xdebug.org/docs/faq#custom-phpize - I ran the phpize for PHP 5.5.3 via:
/Applications/MAMP/bin/php/php5.5.3/bin/phpize
..and got this output:
grep: /Applications/MAMP/bin/php/php5.5.3/include/php/main/php.h: No such file or directory
grep: /Applications/MAMP/bin/php/php5.5.3/include/php/Zend/zend_modules.h: No such file or directory
grep: /Applications/MAMP/bin/php/php5.5.3/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
Just in case this was not an error (since it appeared that I was following XDebug Wizard directions), I then ran configure via:
./configure --with-php-config=/Applications/MAMP/bin/php/php5.5.3/bin/php-config
...and I ran:
make
...but got this error:
fatal error: 'php.h' file not found
What is the correct way to build XDebug on OSX for use by MAMP?
Thanks very much in advance to all for any thoughts or info.
I had a similar issue and it was resolved after installing XCode and the Command Line Tools for XCode. I already had XCode installed, but I recently moved over to a new machine so I had to open it back up and it updated some things. Then I opened Terminal and ran the command...
xcode-select --install
That popped up a prompt to install the command line tools which I did and it resolved my issue.
Incase anyone else stumbles across this from Google...
My issue was the wrong phpize binary was found on the path.
I was able to resolve this using the Xdebug FAQ, specifically this section: https://xdebug.org/docs/faq#custom-phpize
When Xdebug wizard asks you to run phpize, instead find and run phpize in your MAMP directory. For me, this was:
/Applications/MAMP/bin/php/php7.1.19/bin/phpize
After this, you should see an output similar to your tailored installation instructions.
Then find and run php-config in your MAMP directory (Note: this command must be run from where you have Xdebug stored on your machine). For me, this was:
./configure --with-php-config=/Applications/MAMP/bin/php/php7.1.19/bin/php-config
You'll see a bunch of output... Followed by a, "Build complete." message.
Now you can return to your tailored installation instructions (be sure to skip the next step, Run: ./configure).
Try installing autoconf using brew : brew install autoconf

Why isn't cabal-install upgrading itself? [duplicate]

I just installed Haskell from it's official site. After that, following it's quick-start tutorial.
I run:
cabal update
Which shows this message:
Downloading the latest package list from hackage.haskell.org
Note: there is a new version of cabal-install available.
To upgrade, run: cabal install cabal-install
I run:
cabal install cabal-install
and check if the update was successful with
cabal update
The result, it shows me the same message from the start:
Downloading the latest package list from hackage.haskell.org
Note: there is a new version of cabal-install available.
To upgrade, run: cabal install cabal-install
So, did I upgrade the cabal-install or not? How do I check my cabal's version?
Important: I'm using the 64 bits version for Mac OS X.
In my case (and probably others?) cabal is initially installed in /usr/local/bin by homebrew when installing haskell-platform. When upgrading cabal, the version is installed to $HOME/.cabal/bin/cabal. You ought to place your cabal bins higher in your $PATH, like so:
export PATH=$HOME/.cabal/bin:$PATH
I had a similar issue after installing the Haskell platform 2012.4.0.0 on OSX. When I ran cabal install cabal-install, it ended with:
cabal: ../ghc-7.4.2/lib/cabal-install-1.16.0.2/bin/cabal: does not exist
So I guessed it got its paths mixed up somewhere. However the executable was actually built successfully (check for ~/Library/Haskell/ghc-7.4.2/lib/cabal-install-1.16.0.2/bin/cabal) and I just copied it from there to ~/Library/Haskell/bin which is on my path.
Thereafter everything ran OK:
$ which cabal
/Users/luke/Library/Haskell/bin/cabal
$ cabal update
Downloading the latest package list from hackage.haskell.org
$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0.3 of the Cabal library
Everyone seems to experience a slightly different issue here. In my case, cabal was built successfully and installed to ~/Library/Haskell/bin.
As noted in ~/.cabal/config, adding ~/Library/Haskell/bin to PATH solved the issue.
Below is the description in ~/.cabal/config:
-- === Built executables will be installed in:
-- ~/Library/Haskell/bin
--
-- You may wish to place this on your PATH by adding the following
-- line to your ~/.bash_profile:
-- export PATH="$HOME/Library/Haskell/bin:$PATH"
On OS X 10.8 I had to add /Library/Haskell/bin to my PATH (put it before /usr/bin). Adding that fixed the error message
cabal --version gives you the version of cabal you're running. If you want to see the version of cabal-install you have, run cabal info cabal-install and look at the versions installed line.
For me on OS X, versions installed is [unknown], after running cabal install cabal-install, which is not great.
I had this problem too.
After running which cabal, I found that it was using /usr/bin/cabal. Deleting this solved the problem.
It seems that cabal by default installs packages locally for the current user and therefore will not be part of the PATH. Look at the
Cabal documentation specifically step 1.2.1 where you can change the configuration to install things globally by default (not recommended).
The way I installed cabal was cabal --global install cabal-install but still had problems with the path which since the default installation of Haskell puts the path in this order C:\Program Files\Haskell Platform\2013.2.0.0\lib\extralibs\bin;C:\Program Files\Haskell Platform\2013.2.0.0\bin; where the first path has precedence over the second one. With the --global flag cabal installed the binary to C:\Program Files\Haskell\bin which isn't in my path but must be added before the C:\Program Files\Haskell Platform\2013.2.0.0\lib\extralibs\bin path.
Taken from the documentation
You must put the cabal.exe in a directory that is on your %PATH%, for example C:\Program Files\Haskell\bin.
In my case, a combination of several answers here was required to get through this issue. I'll attempt to provide a more comprehensive solution in one answer for anyone else in my situation.
For starters, running which cabal showed me that /usr/bin/cabal was being loaded, which was a symlink to /Library/Haskell/ghc-7.8.3-x86_64/bin/cabal. I believe newer versions of cabal were being installed, but this path was specific to a single version so they were ignored. Adding /Library/Haskell/bin to the front of my $PATH remedied that situation.
Second, and more importantly, the new versions of cabal-install were being installed into my cabal sandbox instead of the system location. I didn't see any other answers suggesting this, but after a little monkeying around I found that moving outside of my application's directory allowed cabal to actually install to the system.
Finally, adding the --global flag to the command fixed the problem. My final command was cabal install --global cabal-install. After this, I was finally able to update properly.
TL;DR: if you use cabal sandboxes, move outside the directory of your project and run cabal install --global cabal-install. Also, check your $PATH variable as others have suggested.
In my case the new version of cabal was being installed in the .cabal-sandbox of the project I was in.
e.g. Checking the version:
./.cabal-sandbox/bin/cabal --version
So I needed to upgrade it outside of that. This was on OSX.

brew install maven 404 error

I did a brew install maven and it resulted in below:
==> Downloading http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0.4-bin.tar.gz
==> Best Mirror http://apache.oss.eznetsols.org/maven/binaries/apache-maven-3.0.4-bin.tar.gz
curl: (22) The requested URL returned error: 404
Error: Download failed: http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0.4-bin.tar.gz
At first I thought it is a mirror problem with my network. But I changed to another network, and it is still the same. And still the same error after 4 days. I wonder if others are affected.
What should I do to install maven with brew?
If you are still getting errors with the url, try brew update and then brew install maven. Fixed the problem for me.
There is something strange with this mirror. You can change this with
brew edit maven
and change the url to
http://www.apache.org/dyn/closer.cgi/maven/maven-3/3.0.4/binaries/apache-maven-3.0.4-bin.tar.gz
e.g.
require 'formula'
class Maven < Formula
homepage 'http://maven.apache.org/'
#url 'http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0.4-bin.tar.gz'
url 'http://www.apache.org/dyn/closer.cgi/maven/maven-3/3.0.4/binaries/apache-maven-3.0.4-bin.tar.gz'
sha1 '0de5dc162bafde3fcb0a6b009cfeea81a042523b'
def install
# Remove windows files
rm_f Dir["bin/*.bat"]
# Fix the permissions on the global settings file.
chmod 0644, Dir["conf/settings.xml"]
prefix.install %w{ NOTICE.txt LICENSE.txt README.txt }
# Install jars in libexec to avoid conflicts
libexec.install Dir['*']
bin.install_symlink Dir["#{libexec}/bin/*"]
end
end
ZenBalance's answer worked for me. I first attempted Emoloney's answer, which caused the following error when I ran brew update:
error: Your local changes to the following files would be overwritten by merge:
Library/Formula/maven.rb
Please, commit your changes or stash them before you can merge.
Aborting Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master
To fix it:
cd /usr/local/Library/Formula
git reset --hard
Then:
brew update
brew install maven
You need to modify the URL using brew edit like Emoloney said,
but most important, don't forget to modify the sha1 code (get it from the same download page of the url). It is important to verify that you downloaded safely the exact file
For me, the following commands did the work:
brew update
brew install maven
update the mirror list of brew first
brew update
and then, try to install again. For this case
brew install maven

Resources