我怎么能在Mac OS X上安装Apache Ant的? [英] How can I install Apache Ant on Mac OS X?

查看:205
本文介绍了我怎么能在Mac OS X上安装Apache Ant的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的Mac上安装Apache Ant和我跟着下面的步骤:

I tried to install Apache Ant on my Mac and I followed the next steps :


  1. 我下载 Apache的ANT-1.8.1-bin.tar.gz 进入我的下载文件夹中。

  2. 我搬到文件到的/ usr /本地/ 使用这个命令:须藤SH MV的apache-ANT-1.8.1-bin.tar.gz在/ usr /本地/

  1. I downloaded apache-ant-1.8.1-bin.tar.gz into my Downloads folder.
  2. I moved the file to /usr/local/ using this commands : sudo sh and mv apache-ant-1.8.1-bin.tar.gz /usr/local/

现在我想用 CD的/ usr /本地/ ,但它不工作,我回来没有这样的文件或目录。

Now I want to use cd /usr/local/ but it's not working, I get back "No such file or directory".

然后我用 CD的/ usr / LS 命令,似乎本地文件夹中是存在的。如果我试图访问它,我得到了同样的错误。

Then I used cd /usr/ and ls commands and it seems that the local folder is there. If I try to access it I get the same error.

由于我已经用须藤苏为什么我不能访问呢?任何想法?

Since I already used sudo su why I can't access it? Any ideas?

推荐答案

蚂蚁上已经安装了一些老版本的Mac OS X的,所以你应该运行蚂蚁-version 以测试是否正在尝试安装前安装。

Ant is already installed on some older versions of Mac OS X, so you should run ant -version to test if it is installed before attempting to install it.

如果尚未安装,那么你最好的选择是安装自制酿造安装Ant )或 MacPorts的 sudo的港口安装apache-蚁),并使用这些工具来安装Apache Ant的。

If it is not already installed, then your best bet is to install Homebrew (brew install ant) or MacPorts (sudo port install apache-ant), and use those tools to install Apache Ant.

另外,虽然我会强烈建议使用自制或MacPorts的相反,你可以手动安装Apache Ant的。要做到这一点,你将需要:

Alternatively, though I would highly advise using Homebrew or MacPorts instead, you can install Apache Ant manually. To do so, you would need to:


  1. DECOM preSS .tar.gz文件。

  2. (可选)把它的地方。

  3. 把bin的子目录在你的路径。

这是你需要,假设 Apache的ANT-1.8.1-bin.tar.gz (用实际版本替换1.8.1)的命令仍然在您的下载目录,将是以下(解释性意见包括):

The commands that you would need, assuming apache-ant-1.8.1-bin.tar.gz (replace 1.8.1 with the actual version) were still in your Downloads directory, would be the following (explanatory comments included):

cd ~/Downloads # Let's get into your downloads folder.
tar -xvzf apache-ant-1.8.1-bin.tar.gz # Extract the folder
sudo mkdir -p /usr/local # Ensure that /usr/local exists
sudo cp -rf apache-ant-1.8.1-bin /usr/local/apache-ant # Copy it into /usr/local
# Add the new version of Ant to current terminal session
export PATH=/usr/local/apache-ant/bin:"$PATH"
# Add the new version of Ant to future terminal sessions
echo 'export PATH=/usr/local/apache-ant/bin:"$PATH"' >> ~/.profile
# Verify new version of ant
ant -version

这篇关于我怎么能在Mac OS X上安装Apache Ant的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆