GoLang及Sublime Text 2之Mac OS X 10.8.4开发环境安装

本文详细介绍了如何在Mac OS X 10.8.4上安装Go语言和配置Sublime Text 2编辑器环境,包括安装Go的步骤、添加环境变量、测试运行、安装gosublime插件以及Sublime Text 2的个性化配置,如快捷键、多选编辑、无干扰模式等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

2013-09-21 wcdj


1 golang简介

Go is an open source programming environment that makes it easy to build simple, reliable, and efficient software.

golang的主页:http://golang.org/


2 Mac OS X 10.8.4环境安装

(1) 下载安装包(详细可参考:http://golang.org/doc/install

http://code.google.com/p/go/downloads/list 链接中选择安装包: go1.2rc1.darwin-amd64-osx10.8.pkg

https://code.google.com/p/go/wiki/Downloads?tm=2 下载页面

(2) 安装

打开下载好的pkg文件,根据安装向导完成安装。默认的安装路径是:/usr/local/go。

mba:go gerryyang$ pwd
/usr/local/go
mba:go gerryyang$ ls
AUTHORS		PATENTS		api		doc		lib		robots.txt
CONTRIBUTORS	README		bin		favicon.ico	misc		src
LICENSE		VERSION		blog		include		pkg		test
(3) 设置环境变量

将/usr/local/go/bin添加到PATH环境变量中:

a. 在home目录下打开.bashrc文件,并将添加:export PATH=$PATH:/usr/local/go/bin,然后保存关闭;

b. 执行 . .bashrc 使环境变量生效;

在command line测试会显示如下内容:

mba:~ gerryyang$ go
Go is a tool for managing Go source code.

Usage:

	go command [arguments]

The commands are:

    build       compile packages and dependencies
    clean       remove object files
    env         print Go environment information
    fix         run go tool fix on packages
    fmt         run gofmt on package sources
    get         download and install packages and dependencies
    install     compile and install packages and dependencies
    list        list packages
    run         compile and run Go program
    test        test packages
    tool        run specified go tool
    version     print Go version
    vet         run go tool vet on packages

Use "go help [command]" for more information about a command.

Additional help topics:

    c           calling between Go and C/C++
    gopath      GOPATH environment variable
    packages    description of package lists
    remote      remote import path syntax
    testflag    description of testing flags
    testfunc    description of testing functions

Use "go help [topic]" for more information about that topic.

mba:~ gerryyang$ 

3 测试

下面使用MacVim编辑:

package main

import "fmt"

func main() {
    fmt.Printf(
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值