Mac上安装 Maven

http://www.tuicool.com/articles/ZV3yUn

Recently I upgraded my Mac OS X to Mavericks (10.9) and I was surprised to see that it doesn’t come with Maven. Earlier versions of Mac OS X such as Lion and Mountain Lion used to have maven installed by default.

There are some third party options such as HomeBrew and using XCode to install Maven on Mac OS X Mavericks but I wanted to do it myself without relying on another software for getting maven working.

Here are the steps that I used to install maven on Mac OS X Mavericks.

Step 1 : Download Maven binaries from Maven Download Page . I was using Maven 3.0.5, so I downloaded apache-maven-3.0.5-bin.tar.gz.

Step 2 : You can install Maven at any location but since it’s a one time process, I didn’t wanted it in my user directory. So I installed it in /usr/local directory. You might have to use sudo command to install in /usr/local directory if you are getting permission denied error.

$ cd /usr/local
$ sudo mv /Users/pankaj/Downloads/apache-maven-3.0.5-bin.tar.gz ./
$ sudo tar -xvf apache-maven-3.0.5-bin.tar.gz

Step 3 : Now open the bash profile file and add following lines into it. Usually profile file names are .bash_profile or .profile, use whichever you have in your system. If you don’t have profile file, you will have to create one with vi command.

$ cd $HOME
$ vi .bash_profile
#Add below lines in the profile
export M2_HOME=/usr/local/apache-maven-3.0.5
export PATH=$PATH:$M2_HOME/bin
#save and quit
$ source .bash_profile

That’s it, maven is installed on your latest Mac OS X and you can verify it by issuing below command.

$ mvn --version
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 05:51:28-0800)
Maven home: /usr/local/apache-maven-3.0.5
Java version: 1.7.0_09, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.9", arch: "x86_64", family: "mac"

You can use this method to install any maven version you would like to use and at your specified location.

Let me know if you find any issues with above setup steps

时间: 2024-10-19 10:40:01

Mac上安装 Maven的相关文章

mac上安装python3 和 sqlite的问题

建议mac上安装python3不要使用源码自己编译安装,而要使用 brew install python3 来安装 另外安装完之后创建需环境的话,要指定新的python环境,如下: virtualenv  -p /usr/local/Cellar/python3/3.6.2/bin/python3  --no-site-packages obpy17 Mac OSX 正确地同时安装Python 2.7 和Python3 Mac OSX 正确地同时安装Python 2.7 和Python3(这个是

Mac上安装brew

用过ubuntu系统的都知道,上面有一个命令apt-get 很方便可以快速的安装很多软件 特别lamp环境 都是一键安装. 在mac上也有类似的命令 brew brew用法可以访问官网地址  http://brew.sh/ 但是在mac上安装 brew 的命令如下 curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C /usr/local --strip 1 但是按照上面的方式安装,都没成功,也没有

mac上安装homebrew

1:关于homebrew下载地址 homebrew下载地址网上版本很多:我用了几个都是显示 404 bad request 如图:均无法现在 有一个网址会给出最新的 安装地址: the URL is:   http://brew.sh/index_zh-cn.html 在网站的最下面给出了通过terminal下载 homebrew的最新的下载地址: 我下载的最新的路径是: ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew

mac上安装unrar和rar解压缩工具

问题描述: mac上默认不支持 rar压缩,但是从windows过来的很多文件,以及邮件中的附件都是通过rar的方式进行压缩的,所以考虑在mac上也能够进行解压缩rar文件 步骤: 1:首先到网站click here上下载RAR 5.10 beta 4 for Mac OS.    2:在terminal下执行执行解压缩命令:tar xvf rarosx-5.1.b4.tar进行解压 3:进入刚刚解压的rar目录中,cd downloads/rar 4:使用如下命令进行安装 mac上安装unra

在mac上安装nodejs

文章转载自我的个人博客  www.iwangzheng.com node.js最初是2009年发布的,目标是为聊实现事件驱动和非阻塞I/O的web服务器,应用的场景非常的广泛,有web服务器.实时应用.分布式应用.游戏.一些工具中,它是基于Chrome的V8引擎开发的.大家可以在github上找到开源代码: http://github.com/joyent/node. 之前用的电脑是windows系统的,现在换了mac之后需要在mac上重新安装下,let's start now ? git cl

在ubuntu上安装maven

下载maven http://maven.apache.org/download.cgi 解压 用压缩管理器打开,解压至home目录下 配置环境变量 sudo gedit /etc/profile 添加 export M2_HOME=<span style="color:#ff0000;">/home/weibo/apache-maven-3.0.5(视自己的情况而定)</span> export M2=$M2_HOME/bin export PATH=$M2:

Mac上安装cocoapods的步骤

命令:$ gem sources --remove https://rubygems.org///等有反应之后再敲入以下命令$ gem sources -a https://ruby.taobao.org/为了验证你的Ruby镜像是并且仅是taobao,可以用以下命令查看:$ gem sources -l只有在终端中出现下面文字才表明你上面的命令是成功的: *** CURRENT SOURCES *** http://ruby.taobao.org/ 这时候,你再次在终端中运行: $ sudo

mac OS 安装maven遇到问题e45: &#39;readonly&#39; option is set

1.下载 Maven, 并解压到某个目录.例如/Users/yintingting/apache-maven-3.3.9 2.打开Terminal,输入以下命令,设置Maven classpath vi ~/.bash_profile 3.添加下列两行代码,之后保存并退出Vi: export M2_HOME=/Users/yintingting/apache-maven-3.3.9(这里写你自己的maven文件路径) export PATH=$PATH:$M2_HOME/bin 4.然后按ESC

mac 上安装 redis

mac 上安装 redis 首先必须保证mac 已经安装 xcode. 因为make时要用到 Xcode 的command Tools . (1)下载 redis   http://redis.googlecode.com/files/redis-2.8.7.tar.gz 解压到当前目录. (2)你也可以在终端下载: 1 2 curl -O http://redis.googlecode.com/files/redis-2.8.7.tar.gz sudo tar -zxf redis-2.8.7