LoginSignup
6
1

More than 3 years have passed since last update.

Go言語のインストール方法(Mac)

Last updated at Posted at 2019-11-19

はじめに

私の感覚ですが、Vimを使っている人はGo使いが多い気がします。
私もVimを使いたいのでGoを書くことにします。(手段が目的)

「Go言語」とは?

Googleが2009年に発表した、オープンソースのプログラミング言語です。

環境

  • OS:macOS Catalina 10.15
  • Go:1.13.4

セットアップ

インストール

公式サイトからパッケージファイルをダウンロードします。
https://golang.org/dl/

スクリーンショット_2019-11-19_22_47_36.jpg

パッケージファイルを実行し、ウィザードに従ってインストールします。

[続ける]をクリックします。
スクリーンショット 2019-11-19 22.53.26.png

[インストール]をクリックします。
スクリーンショット 2019-11-19 22.54.08.png

インストールが始まります。
スクリーンショット 2019-11-19 22.54.24.png

インストールが完了しました。

[閉じる]をクリックします。
スクリーンショット 2019-11-19 22.58.21.png

バージョンとインストール先の確認

バージョンとインストール先を確認します。

$ go version
go version go1.13.4 darwin/amd64

$ which go
/usr/local/go/bin/go

ビルドの確認

ビルドできるか確認します。

以下のファイルを作成します。

hello.go
package main

import "fmt"

func main() {
    fmt.Printf("hello, world\n")
}

go run コマンドでプログラムをビルドして実行します。

$ go run hello.go
hello, world

「hello, world」が出力されたため、Go言語のインストールに成功しています。

おわりに

Go言語のインストールは非常に簡単でした。

次は開発環境を構築します。

チュートリアルもやります。
https://go-tour-jp.appspot.com/list

参考リンク

6
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
1