我可以在 ubuntu 中安装 xcode 吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36303013/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 18:16:47  来源:igfitidea点击:

Can I install xcode in ubuntu?

xcodemacosubuntuvmware

提问by MahajanSagar

I have Ubuntu in my virtual machine, i want to run X code in Ubuntu.I just download swift from site but don't know how to install it in Ubuntu. https://swift.org/builds/swift-2.2-release/ubuntu1404/swift-2.2-RELEASE/swift-2.2-RELEASE-ubuntu14.04.tar.gz

我的虚拟机中有 Ubuntu,我想在 Ubuntu 中运行 X 代码。我只是从站点下载 swift 但不知道如何在 Ubuntu 中安装它。 https://swift.org/builds/swift-2.2-release/ubuntu1404/swift-2.2-RELEASE/swift-2.2-RELEASE-ubuntu14.04.tar.gz

回答by Anatoli P

If you want to install Xcodein Ubuntu, that is impossible, as already pointed out by Deepak: Xcode is not available on Linux at this time and I don't expected it to be in the foreseeable future.

如果你想在 Ubuntu 中安装Xcode,那是不可能的,正如 Deepak 已经指出的那样:目前 Xcode 在 Linux 上不可用,我不希望在可预见的未来。

However, if you want to install Swift on Ubuntu and play with it from the command line, that is quite easy to do. The instructions are at the http://www.swift.orgsite, but here is a brief recap, assuming you are in your home directory:

但是,如果您想在 Ubuntu 上安装 Swift 并从命令行使用它,这很容易做到。说明位于http://www.swift.org站点,但这里是一个简短的回顾,假设您在您的主目录中:

1) Download the distribution:

1) 下载发行版:

user@ubuntu14:~$ wget https://swift.org/builds/swift-2.2-release/ubuntu1404/swift-2.2-RELEASE/swift-2.2-RELEASE-ubuntu14.04.tar.gz

2) Unpack it:

2)解压:

user@ubuntu14:~$ tar xf swift-2.2-RELEASE-ubuntu14.04.tar.gz

3) Prepend the location of the binaries to your $PATH:

3)将二进制文件的位置预先添加到您的$PATH

user@ubuntu14:~$ export PATH=$HOME/swift-2.2-RELEASE-ubuntu14.04/usr/bin:$PATH

That's it as far as installation. Now you can do a few things with it, these are just examples.

就安装而言就是这样。现在你可以用它做一些事情,这些只是例子。

Run the REPL:

运行 REPL:

user@ubuntu14:~$ swift
Welcome to Swift version 2.2 (swift-2.2-RELEASE). Type :help for assistance.
  1> 1 + 3
$R0: Int = 4
  2> :quit
user@ubuntu14:~$ 

Create a Swift source file, call it junk.swift, with the following contents:

创建一个 Swift 源文件,命名为junk.swift,内容如下:

print("Hi from swift!")

Then run it through the Swift interpreter:

然后通过 Swift 解释器运行它:

user@ubuntu14:~$ swift junk.swift
Hi from swift!

Now compile it with the Swift compiler:

现在用 Swift 编译器编译它:

user@ubuntu14:~$ swiftc junk.swift

This will create an executable called junkin your current directory. Run it:

这将创建一个junk在当前目录中调用的可执行文件。运行:

user@ubuntu14:~$ ./junk
Hi from swift!

You can do a lot more, please see documentation at https://swift.org/getting-started/#using-the-build-system

您可以做更多的事情,请参阅https://swift.org/getting-started/#using-the-build-system 上的文档

Please make sure your Ubuntu installation is 64-bit. If it is, then the string x86_64should be found somewhere in the output of the uname -acommand. AFAIK, currently Apple provides this software only for 64-bit Ubuntu 14.04 or Ubuntu 15.10, make sure you download the correct version.

请确保您的 Ubuntu 安装是 64 位。如果是,那么x86_64应该在uname -a命令输出的某处找到该字符串。AFAIK,目前 Apple 仅为 64 位 Ubuntu 14.04 或 Ubuntu 15.10 提供此软件,请确保您下载正确的版本。

Another thing to note is that Swift on Linux is not as usable as it is on Mac OS X. A lot of libraries have not been ported yet. Again, see the swift.org site for more details.

另一件需要注意的事情是,Linux 上的 Swift 不如 Mac OS X 上的好用。很多库还没有被移植。同样,请参阅 swift.org 站点以获取更多详细信息。