通过终端编程 (Mac)
我一直在使用 Textmate 编写 C 源代码,但想通过终端完成所有操作。
如何通过终端进行编程?还需要安装什么吗?
I have been using Textmate for writing my C source but want to do everything via the terminal.
How does one program via the terminal? Is anything else needed, installed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为了在终端上编写源代码,您当然需要一个可在终端上运行的编辑器。在 OS X 中,您有很多选项可供选择。如果您想要简单易用的编辑器,您可能需要尝试 OS X 上提供的
nano
和pico
。如果您开始想要一点或更多功能的文本编辑器,那么您可能想尝试像vim
和emacs
这样的编辑器,它们在 OS X 下也可用。为了编译您的
C 源,您将需要一个
C
编译器。虽然默认情况下,OS X 并未预装C
编译器,但您可以快速安装大量开发工具,这些工具可在您购买时获得的 OS X 安装光盘中找到。买了你的Mac。这些工具将为您提供gcc
(这是 GNU C 编译器,您可以在终端上使用它来编译您的C
源代码)、gdb -- 这是 GNU 调试器,您可以进一步使用它来调试编译的
C
源代码 --,make
-- 这是 GNU make,一个程序,当您开始必须管理许多C
源文件,这些文件可以通过创建 make 文件和自动化构建操作来帮助您,以及随着您花更多时间您可能想要探索的许多其他工具并熟悉该系统。In order to write source code on the Terminal, you will of course need an editor that works on the Terminal. In OS X, you have a lot of options to choose from. If you want simple and easy to use editors, you may want to try
nano
andpico
that are available on OS X. If you start to want a little or more functionality out of the text editor, then you may want to try editors likevim
andemacs
, which are also available under OS X.In order to compile your
C
source, you will require aC
compiler. While OS X does not, by default, come pre-installed with aC
compiler, you can quickly install a slew of development tools that are available in the OS X installation discs that you may have got when you bought your Mac. Those tools will provide you withgcc
-- which is the GNU C compiler that you can use on the Terminal to compile yourC
sources --,gdb
-- which is the GNU Debugger that you can further use to debug your compiledC
source --,make
-- which is GNU make, a program that, when you start to have to manage a number ofC
source files, can help you by creating make files and automating build operations -- and a number of other tools that you may want to explore as you spend more time with the system and become familiar with it.您可以使用
emacs
或vi
。vi
默认包含在 osx 中。You can use
emacs
orvi
.vi
is included in osx by default.您可以使用终端文本编辑器,例如 vim 或 emacs。您可能还需要安装 gcc。
所有这些程序都可以通过任何端口系统获得。
You can use a terminal text editor such as vim or emacs. You may also need to install gcc.
All these programs are available through any ports system.